Advertisement
Guest User

1

a guest
Feb 2nd, 2020
1,183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. inheritance = float(input())
  2.  
  3. age = 18
  4.  
  5. for year in range(1800, int(input()) + 1):
  6.     if year % 2 == 0:
  7.         inheritance -= 12000
  8.     else:
  9.         inheritance -= 12000 + 50 * age
  10.  
  11.     age += 1
  12.  
  13. if inheritance >= 0:
  14.     print(f'Yes! He will live a carefree life and will have {inheritance:.2f} dollars left.')
  15. else:
  16.     print(f'He will need {abs(inheritance):.2f} dollars to survive.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement