Advertisement
simeonshopov

Back to the Past

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