Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- age = int(input())
- machine = float(input())
- toy_price = float(input())
- total_sum = 0
- toy = 0
- birthday = 10
- for i in range(1, age + 1):
- if i % 2 == 0:
- total_sum += birthday - 1
- birthday += 10
- else:
- toy += 1
- total_sum += toy * toy_price
- if total_sum >= machine:
- print(f'Yes! {total_sum - machine:.2f}')
- else:
- print(f'No! {machine - total_sum:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement