Wednesday, September 17, 2014
O yeah, practice!
O yeah, prepare for interview, need some practice :)
from random import randint
level_1 = 2
level_2 = 2
keyboard_input = ''
while keyboard_input != 'quit' :
num1 = randint(10 ** (level_1 -1), 10 ** level_1)
num2 = randint(10 ** (level_2 -1), 10 ** level_2)
ans = num1 * num2
print ("%d * %d \n" % (num1, num2))
ans_input = raw_input()
while int(ans_input) != ans :
if ans_input == '-1' :
print (ans)
break
ans_input = raw_input('wrong answer\n')
print('correct\n')
keyboard_input = raw_input('next?')
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment