Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- money = float(input())
- year = int(input())
- age = 18
- for i in range(1800, year + 1):
- if i % 2 == 0:
- money -= 12000
- else:
- money -= 12000 + 50 * age
- age += 1
- if money < 0:
- print(f'He will need {abs(money):.2f} dollars to survive.')
- else:
- print(f'Yes! He will live a carefree life and will have {money:.2f} dollars left.')
- РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
- money = float(input())
- year = int(input())
- age = 18
- for i in range(1800, year + 1):
- money -= 12000 + (0 if i % 2 == 0 else 50 * age)
- age += 1
- print(f'He will need {abs(money):.2f} dollars to survive.' if money < 0 else
- f'Yes! He will live a carefree life and will have {money:.2f} dollars left.')
- ИЛИ ЛЕКО ТАРИКАТСКАТА:)
- money = float(input())
- year = int(input()) - 1800
- for i in range(year + 1):
- money -= 12000 + (0 if i % 2 == 0 else 50 * (18 + i))
- print(f'He will need {abs(money):.2f} dollars to survive.' if money < 0 else
- f'Yes! He will live a carefree life and will have {money:.2f} dollars left.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement