1def курс_в_лева(exchange_rates):
2 return {currency : round(1/value, 4) for currency, value in exchange_rates.items()}
3
4def валута_към_левчета(*args, **kwargs):
5 result = {}
6 for currency, value in args:
7 result[currency] = round(result.get(currency, 0) + value/kwargs.get(currency,1), 4)
8 return list(result.items())
9
10def е_патриотична(amount, exchange_rates):
11 sum = 0
12 for currency, value in amount:
13 sum += value/exchange_rates[currency]
14 sum = round(sum, 2)
15 if sum==int(sum):
16 return "ПАТРИОТИЧНА!"
17 else:
18 return "НЕПАТРИОТИЧНА!"
..........
----------------------------------------------------------------------
Ran 10 tests in 0.000s
OK
05.03.2026 18:30
05.03.2026 18:30
05.03.2026 18:31