Sichanov

backtothepast

Feb 1st, 2021
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. money = float(input())
  2. final_year = int(input())
  3. years_old = 18
  4.  
  5. for year in range(1800, final_year + 1):
  6.     if year % 2 == 0:
  7.         money -= 12000
  8.     else:
  9.         money -= 12000 + 50 * years_old
  10.     years_old += 1
  11. if money >= 0:
  12.     print(f'Yes! He will live a carefree life and will have {money:.2f} dollars left.')
  13. else:
  14.     print(f'He will need {abs(money):.2f} dollars to survive.')
Advertisement
Add Comment
Please, Sign In to add comment