Advertisement
aneliabogeva

Back To The Past

May 30th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. money = float(input())
  2. year = int(input())
  3. starting_year = 1800
  4. rest_money = 0
  5.  
  6. while starting_year <= year:
  7. if starting_year % 2 == 0:
  8. money -= 12000
  9. rest_money = money
  10. else:
  11. years_old = 18 + (starting_year % 10)
  12. money -= 12000+50*(years_old)
  13. rest_money = money
  14. starting_year += 1
  15. if rest_money >= 0:
  16. print(f"Yes! He will live a carefree life and will have {rest_money:.2f} dollars left.")
  17. else:
  18. print(f"He will need {abs(rest_money):.2f} dollars to survive.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement