1def курс_в_лева(exchange_rates):
2 new_rates = exchange_rates.copy()
3 for x in new_rates:
4 new_rates[x] = round(1 / new_rates[x], 4)
5 return new_rates
6
7def валута_към_левчета(*arg1, **arg2):
8 result = {}
9 for currency, amount in arg1:
10 if currency == "BGN":
11 lv = round(amount, 4)
12 else:
13 rate = arg2[currency]
14 lv = round(amount / rate, 4)
15
16 if currency in result:
17 result[currency] += lv
18 else:
19 result[currency] = lv
20 return result
21
22def е_патриотична(amount, exchange_rates):
23 lv = 0
24 for currency, money in amount:
25 lv += money / exchange_rates[currency]
26 lv = round(lv,2)
27 if lv == int(lv):
28 return "ПАТРИОТИЧНА!"
29 else:
30 return "НЕПАТРИОТИЧНА!"
..........
----------------------------------------------------------------------
Ran 10 tests in 0.000s
OK
Виктор Бечев
11.03.2026 18:21Останалите неща, които забелязвам са доста сходни с масовите пропуски и ще ги споменем на лекцията след малко.
|
11.03.2026 18:21
11.03.2026 18:19