coding utf-8 import random print Welcome to the game Please choose dif

 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
29
30
31
# -*- coding: utf-8 -*-
import random
print("Welcome to the game! Please, choose difficulty")
difficulty = input("Just write \"hard\", \"medium\", or \"low\".")
if difficulty == "hard":
counterRepetitions = 10
elif difficulty == "medium":
counterRepetitions = 5
else:
counterRepetitions = 3
while 0 < counterRepetitions:
strAnswer = '{}+{}'.format(random.randint(1,100),random.randint(1,100))
intAnswer = eval(strAnswer)
anonAnswer = (0)
print('Let\'s try solve this - {}'.format(strAnswer))
anonAnswer = int(input())
if anonAnswer == intAnswer:
print("That's right! Good job!")
else:
print("False, this is wrong. Try again.")
print("If you want to see result - write \"yes\". If not - just press Enter")
answer = input()
if answer == "yes" or answer == "yes" or answer =="y" or answer == "да":
print('Result is {}'.format(intAnswer))