Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- budget = int(input())
- season = input()
- volume = int(input())
- price = 0
- if season == 'Spring':
- price = 3000
- elif season == 'Winter':
- price = 2600
- else:
- price = 4200
- if volume <= 6:
- price *= 0.9
- elif volume > 11:
- price *= 0.75
- else:
- price *= 0.85
- if volume % 2 == 0 and season != 'Autumn':
- price *= 0.95
- budget -= price
- if budget >= 0:
- print(f'Yes! You have {budget:.2f} leva left.')
- else:
- print(f'Not enough money! You need {abs(budget):.2f} leva.')
- РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
- budget = int(input())
- season = input()
- volume = int(input())
- price = 3000 if season == 'Spring' else 2600 if season == 'Winter' else 4200
- price *= 0.9 if volume <= 6 else 0.75 if volume > 11 else 0.85
- price *= 0.95 if volume % 2 == 0 and season != 'Autumn' else 1
- budget -= price
- print(f'Yes! You have {budget:.2f} leva left.' if budget >= 0 else
- f'Not enough money! You need {abs(budget):.2f} leva.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement