import random
L1 = random.randint(0,24)
R1 = random.randint(0,24)
L2 = random.randint(25,49)
R2 = random.randint(25,49)
L3 = random.randint(50,74)
R3 = random.randint(50,74)
L4 = random.randint(75,101)
R4 = random.randint(75,101)
slog = int(input('Введи уровень сложности от 1 до 4 - '))
def vebor1():
if slog == 1:
oper1()
def vebor2():
if slog == 2:
oper2()
def vebor3():
if slog == 3:
oper3()
def vebor4():
if slog == 4:
oper4()
def oper1(LL1,RR1):
operation = random.choice(['+', '-', '*', '/'])
print('{} {} {}'.format(LL1, operation, RR1))
if operation == '+':
res = LL1 + RR1
elif operation == '-':
res = LL1 - RR1
elif operation == '*':
res = LL1 * RR1
else:
res = LL1 / RR1
if int(input('Введи ответ -> ')) == res:
return 'Ответ = {}'.format(res)
else:
return 'Не правильно! {}'.format(res)
def oper2(LL2,RR2):
operation = random.choice(['+', '-', '*', '/'])
print('{} {} {}'.format(LL2, operation, RR2))
if operation == '+':
res = LL2 + RR2
elif operation == '-':
res = LL2 - RR2
elif operation == '*':
res = LL2 * RR2
else:
res = LL2 / RR2
if int(input('Введи ответ -> ')) == res:
return 'Ответ = {}'.format(res)
else:
return 'Не правильно! {}'.format(res)
def oper3(LL3,RR3):
operation = random.choice(['+', '-', '*', '/'])
print('{} {} {}'.format(LL3, operation, RR3))
if operation == '+':
res = LL3 + RR3
elif operation == '-':
res = LL3 - RR3
elif operation == '*':
res = LL3 * RR3
else:
res = LL3 / RR3
if int(input('Введи ответ -> ')) == res:
return 'Ответ = {}'.format(res)
else:
return 'Не правильно! {}'.format(res)
def oper4(LL4,RR4):
operation = random.choice(['+', '-', '*', '/'])
print('{} {} {}'.format(LL4, operation, RR4))
if operation == '+':
res = LL4 + RR4
elif operation == '-':
res = LL4 - RR4
elif operation == '*':
res = LL4 * RR4
else:
res = LL4 / RR4
if int(input('Введи ответ -> ')) == res:
return 'Ответ = {}'.format(res)
else:
return 'Не правильно! {}'.format(res)
if slog == 1:
print(oper1(L1, R1))
elif slog == 2:
print(oper1(L2, R2))
elif slog == 3:
print(oper1(L3, R3))
elif slog == 4:
print(oper1(L4, R4))
L1 = random.randint(0,24)
R1 = random.randint(0,24)
L2 = random.randint(25,49)
R2 = random.randint(25,49)
L3 = random.randint(50,74)
R3 = random.randint(50,74)
L4 = random.randint(75,101)
R4 = random.randint(75,101)
slog = int(input('Введи уровень сложности от 1 до 4 - '))
def vebor1():
if slog == 1:
oper1()
def vebor2():
if slog == 2:
oper2()
def vebor3():
if slog == 3:
oper3()
def vebor4():
if slog == 4:
oper4()
def oper1(LL1,RR1):
operation = random.choice(['+', '-', '*', '/'])
print('{} {} {}'.format(LL1, operation, RR1))
if operation == '+':
res = LL1 + RR1
elif operation == '-':
res = LL1 - RR1
elif operation == '*':
res = LL1 * RR1
else:
res = LL1 / RR1
if int(input('Введи ответ -> ')) == res:
return 'Ответ = {}'.format(res)
else:
return 'Не правильно! {}'.format(res)
def oper2(LL2,RR2):
operation = random.choice(['+', '-', '*', '/'])
print('{} {} {}'.format(LL2, operation, RR2))
if operation == '+':
res = LL2 + RR2
elif operation == '-':
res = LL2 - RR2
elif operation == '*':
res = LL2 * RR2
else:
res = LL2 / RR2
if int(input('Введи ответ -> ')) == res:
return 'Ответ = {}'.format(res)
else:
return 'Не правильно! {}'.format(res)
def oper3(LL3,RR3):
operation = random.choice(['+', '-', '*', '/'])
print('{} {} {}'.format(LL3, operation, RR3))
if operation == '+':
res = LL3 + RR3
elif operation == '-':
res = LL3 - RR3
elif operation == '*':
res = LL3 * RR3
else:
res = LL3 / RR3
if int(input('Введи ответ -> ')) == res:
return 'Ответ = {}'.format(res)
else:
return 'Не правильно! {}'.format(res)
def oper4(LL4,RR4):
operation = random.choice(['+', '-', '*', '/'])
print('{} {} {}'.format(LL4, operation, RR4))
if operation == '+':
res = LL4 + RR4
elif operation == '-':
res = LL4 - RR4
elif operation == '*':
res = LL4 * RR4
else:
res = LL4 / RR4
if int(input('Введи ответ -> ')) == res:
return 'Ответ = {}'.format(res)
else:
return 'Не правильно! {}'.format(res)
if slog == 1:
print(oper1(L1, R1))
elif slog == 2:
print(oper1(L2, R2))
elif slog == 3:
print(oper1(L3, R3))
elif slog == 4:
print(oper1(L4, R4))