-
Notifications
You must be signed in to change notification settings - Fork 0
/
age_calculate.py
33 lines (22 loc) · 887 Bytes
/
age_calculate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
age = int(input("What's your age? "))
unit = input("Please choose time unit: Months, Weeks, Days, Hours, Minutes, Seconds. \nNote: You can write the first letter or the full name of the time unit. ").strip().lower()
months = age * 12
weeks = months * 4
days = age * 365
hours = days * 24
minutes = hours * 60
seconds = minutes * 60
if unit == 'months' or unit == 'm':
print(f'You lived for {months:,} Months')
elif unit == 'weeks' or unit == 'w':
print(f'You lived for {weeks:,} Weeks')
elif unit == 'days' or unit == 'd':
print(f'You lived for {days:,} Days')
elif unit == 'hours' or unit == 'H':
print(f'You lived for {hours:,} Hours')
elif unit == 'minutes' or unit == 'm':
print(f'You lived for {minutes:,} Minutes')
elif unit == 'seconds' or unit == 's':
print(f'You lived for {seconds:,} Seconds')
else:
print('Your choice is not available')