Sichanov

backtothepast

May 9th, 2021
152
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. last_year = int(input())
  3. year = 18
  4. for years in range(1800, last_year + 1):
  5.     if years % 2 == 0:
  6.         money -= 12000
  7.     else:
  8.         money -= (12000 + 50 * year)
  9.     year +=1
  10. if money >=0:
  11.     print(f'Yes! He will live a carefree life and will have {money:.2f} dollars left.')
  12. else:
  13.     print(f'He will need {abs(money):.2f} dollars to survive.')
Advertisement
Add Comment
Please, Sign In to add comment