Skip to content

Commit f68bb42

Browse files
committed
Added excercise_5.py to Python-Basic-to-Advance repo
1 parent a1f9593 commit f68bb42

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

excercise_5.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Wap to find out how many days,month,
2+
weeks we have left-
3+
if we live until 90 years old"""
4+
age = int(input("Enter age:")) # Take age as input from the user
5+
years_left = 90 - age # Calculate years left until age 90
6+
days_left = years_left * 365 # Approximate days left (ignoring leap years)
7+
months_left = years_left * 12 # Approximate months left
8+
weeks_left = years_left * 52 # Approximate weeks left
9+
10+
# Print the result using f-string formatting
11+
print(f"{years_left} Years {months_left} months {days_left} days {weeks_left} weeks")

0 commit comments

Comments
 (0)