Код:
def answ_a(a, b):
# а #
return a % b + b
def answ_b(a, b):
# б #
return a // b + a
def answ_v(a, b):
# в #
b = a // b
return a // b
def answ_g(a, b):
# г #
b = a // b + b
return a % b + a
def answ_d(a, b):
# д #
b = a % b + 4
return a % b + 1
def answ_e(a, b):
# е #
return a % (b+1)
def answ_dg(a, b):
# ж #
b = a % b
return a // (b+1)
nums_arr = {
"а": answ_a,
"б": answ_b,
"в": answ_v,
"г": answ_g,
"д": answ_d,
"е": answ_e,
"ж": answ_dg
}
a = 26
b = 6
for key, func in nums_arr.items():
print(key+":", func(a, b))
Вывод:
а: 8
б: 30
в: 6
г: 32
д: 3
е: 1
ж: 8
Код:
def answ_a(a, b):
# а #
return a % b + b
def answ_b(a, b):
# б #
return a // b + a
def answ_v(a, b):
# в #
b = a // b
return a // b
def answ_g(a, b):
# г #
b = a // b + b
return a % b + a
def answ_d(a, b):
# д #
b = a % b + 4
return a % b + 1
def answ_e(a, b):
# е #
b = a // b
return a % (b+1)
def answ_dg(a, b):
# ж #
b = a % b
return a // (b+1)
nums_arr = {
"а": answ_a,
"б": answ_b,
"в": answ_v,
"г": answ_g,
"д": answ_d,
"е": answ_e,
"ж": answ_dg
}
a = 26
b = 6
for key, func in nums_arr.items():
print(key+":", func(a, b))
Вывод:
а: 8
б: 30
в: 6
г: 32
д: 3
е: 1
ж: 8