Advertisement
George_Ivanov05

01. Back To The Past

Mar 3rd, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. money = float(input())
  2. years = int(input())
  3.  
  4. money_spent = 0
  5.  
  6. for number in range(1800, years + 1):
  7.     if years % 2 == 0:
  8.         money_spent = 12000
  9.     elif years % 2 != 0:
  10.         money_spent = 12000 + 50
  11.  
  12. if money >= money_spent:
  13.     money_left = money - money_spent
  14.     print(f"Yes! He will live a carefree life and will have {money_left:.2f} dollars left.")
  15. elif money < money_spent:
  16.     money_need = money_spent - money
  17.     print(f"He will need {money_need:.2f} dolllars to survive")
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement