Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lifespan = 80
- age = int(input('Enter your age: '))
- # Ask if they smoke. Notice that this is not int(input()) because we're not asking for a number.
- smokes = input('Do you smoke? (Y/N): ').strip().upper()
- # If they answered Y, they lose 10 years. Otherwise they lose 0 years.
- if smokes == 'Y':
- smoking_factor = 10
- else:
- smoking_factor = 0
- remaining = lifespan - age - smoking_factor
- print(f'You have {remaining} years left to live.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement