Untitled
unknown
plain_text
2 years ago
1.0 kB
10
Indexable
#Past Exam v1 question
keepGoing = True
while keepGoing == True:
first = int(input('Enter 1st operand: '))
second = int(input('Enter 2nd operand: '))
addition = int(input('What is ' + str(first) + ' + ' + str(second) + '? '))
addAns = first + second
if addition == addAns:
print('Correct!')
else:
print('Your answer is wrong.')
subtraction = int(input('What is ' + str(first) + ' - ' + str(second) + '? '))
subAns = first - second
if subtraction == subAns:
print('Correct!')
else:
print('Your answer is wrong.')
multiply = int(input('What is ' + str(first) + ' * ' + str(second) + '? '))
mulAns = first * second
if multiply == mulAns:
print('Correct!')
else:
print('Your answer is wrong.')
keepGoing = input('Do you want to continue(y/n)? ')
if keepGoing == 'y':
keepGoing = True
if keepGoing == 'n':
keepGoing = False
print('Bye!')
Editor is loading...