Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- budget = float(input())
- volume = int(input())
- for i in range(volume):
- name = input()
- cash = float(input())
- if name == "Thrones":
- cash /= 2
- elif name == "Lucifer":
- cash *= 0.6
- elif name == "Protector":
- cash *= 0.7
- elif name == "TotalDrama":
- cash *= 0.8
- elif name == "Area":
- cash *= 0.9
- budget -= cash
- if budget >= 0:
- print(f"You bought all the series and left with {budget:.2f} lv.")
- else:
- print(f"You need {abs(budget):.2f} lv. more to buy the series!")
- Решение с тернарен оператор леко тарикатската:)
- budget = float(input())
- volume = int(input())
- for i in range(volume):
- name = input()
- budget -= (0.5 if name == 'Thrones' else
- 0.6 if name == 'Lucifer' else
- 0.7 if name == 'Protector' else
- 0.8 if name == 'TotalDrama' else
- 0.9 if name == 'Area' else 1) * float(input())
- print(f'You bought all the series and left with {budget:.2f} lv.' if budget >= 0
- else f'You need {abs(budget):.2f} lv. more to buy the series!')
Add Comment
Please, Sign In to add comment