1def курс_в_лева(exchange_rates):
2 return {key: round(1 / value, 4) for (key, value) in exchange_rates.items()}
3
4
5def валута_към_левчета(*args, **kwargs):
6 total = dict()
7 for code, qnty in args:
8 total[code] = total.get(code, 0) + qnty
9
10 return [
11 (code, round((val if code == "BGN" else val / kwargs[code]), 4))
12 for code, val in total.items()
13 ]
14
15
16def е_патриотична(amount, exchange_rates):
17 total_amounts = dict()
18 for code, qnty in amount:
19 total_amounts[code] = total_amounts.get(code, 0) + qnty
20
21 res = 0
22 for code, qnty in total_amounts.items():
23 res += qnty / exchange_rates.get(code, 1)
24
25 res = round(res, 2).is_integer()
26
27 if res:
28 return "ПАТРИОТИЧНА!"
29 return "НЕПАТРИОТИЧНА!"
..........
----------------------------------------------------------------------
Ran 10 tests in 0.000s
OK
11.03.2026 14:16
11.03.2026 14:18