Advertisement
bl00dt3ars

01. Back To The Past

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