PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# design for header/ASCII to make it look fancy
print('|--------------------------------|')
print('| Addition Quiz |')# print design to screen
print('|--------------------------------|')
print('\n')# insert a blank line on screen
# import libraries used
import random
# define functions
def printIntro():
print('Please choose a difficulty level E, I, or H')
print('(E)asy, (I)ntermediate, (H)ard')
global choice
choice = input('Please input the letter of your difficulty: ')
return choice
def generateProblem(int1, int2):
if choice == 'e' or choice == 'E':
print('You have selected (E)asy and will receive addition problems with numbers 0-10')
int1 = random.randint(0, 10)
int2 = random.randint(0, 10)
correct = int1 + int2
print(int1, '+', int2 )
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run