Skip to content

Commit 3651a43

Browse files
Add files via upload
1 parent a30110b commit 3651a43

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Age Calculator.py

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"""
2+
This is an age calculator which will tell you your current age,
3+
by entering your date of birth.
4+
"""
5+
6+
print("AGE CALCULATOR".center(45) + '\n' + '\n')
7+
8+
# Function for years....
9+
import datetime
10+
11+
current_year = datetime.datetime.now().year
12+
13+
# Function for months....
14+
15+
import datetime
16+
17+
current_month = datetime.datetime.now().month
18+
19+
# Function for days....
20+
21+
from datetime import date
22+
today = date.today()
23+
24+
from datetime import datetime
25+
26+
""""
27+
current_time = datetime.now()
28+
print(current_time.strftime("%H:%M:%S")
29+
)
30+
"""
31+
32+
print("Enter Your Date Of Birth".upper() + '\n'
33+
)
34+
d1 = int(input("date:".upper()
35+
)
36+
)
37+
m1 = int(input("month:".upper()
38+
)
39+
)
40+
y1 = int(input("year:".upper()
41+
)
42+
)
43+
print('\n' "Age".upper() , "=" , current_year - y1, "Years", current_month - m1,
44+
"Months",
45+
today.day - d1, "Days" + '\n'
46+
)

0 commit comments

Comments
 (0)