Advertisement
BbJLeB

01. Back To The Past

May 30th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. # 01. Back To The Past
  2.  
  3. gift_money = float(input())
  4. need_money_1 = 0
  5. need_money_2 = 0
  6. years = 18
  7. last_year = int(input())
  8. last_year_1 = 1800
  9. for i in range(1800, last_year +1):
  10.     if last_year_1 % 2 == 0:
  11.         need_money_2 += 12000
  12.         years += 1
  13.         last_year_1 += 1
  14.     else:
  15.         need_money_1 += 12000 + (50 * years)
  16.         years += 1
  17.         last_year_1 += 1
  18.  
  19. end_money = gift_money - (need_money_1 + need_money_2)
  20. if end_money >= 0:
  21.     print(f"Yes! He will live a carefree life and will have {end_money:.2f} dollars left.")
  22. else:
  23.     print(f"He will need {abs(end_money):.2f} dollars to survive.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement