Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- # Please don't hate me for this
- """
- 1 = Normal
- """
- maxi = 5
- symbols = ['-', '+', '/', '*']
- prob = []
- for x in range(random.randint(2,5)):
- created = ''
- created += str(random.randint(1, maxi))+" "
- created += str(random.choice(symbols))+" "
- created += str(random.randint(1, maxi))+" "
- prob.append(created)
- prob.append(random.choice(symbols)+" ")
- del prob[len(prob)-1]
- problem = ''
- for t in prob:
- problem += t
- exec('ans = round({}, 0)'.format(problem))
- print(ans)
- problem += "= "
- player_ans = input(problem)
- if int(player_ans) == ans:
- print("Correct!")
- else:
- print("Nope!!")
Advertisement
Add Comment
Please, Sign In to add comment