1def курс_в_лева(exchange_rates):
2 result = {}
3
4 for currency, rate in exchange_rates.items():
5 new_rate = 1 / rate
6 result[currency] = round(new_rate, 4)
7
8 return result
9
10def валута_към_левчета(*args, **kwargs):
11 result = {}
12
13 for currency, amount in args:
14 if currency == "BGN":
15 rate = 1
16 else:
17 rate = kwargs[currency]
18 leva = amount / rate
19 leva = round(leva, 4)
20
21 if currency not in result:
22 result[currency] = 0
23
24 result[currency] += leva
25
26 return result
27
28def е_патриотична(amounts, exchange_rates):
29 total = 0
30
31 for currency, amount in amounts:
32 if currency == "BGN":
33 rate = 1
34 else:
35 rate = exchange_rates[currency]
36 total += amount / rate
37
38 total = round(total, 2)
39
40 if total == int(total):
41 return "ПАТРИОТИЧНА!"
42 else:
43 return "НЕПАТРИОТИЧНА!"
..........
----------------------------------------------------------------------
Ran 10 tests in 0.000s
OK
Виктор Бечев
11.03.2026 16:23Повечето грешки, които си допуснала ще ги коментираме след няколко часа, защото са масови. Stay tuned.
|
11.03.2026 16:22
11.03.2026 16:21