DEV Community

Hamza Hesham
Hamza Hesham

Posted on • Updated on

simple age calc using python

hello, today we will make a simple age calc using python
first we will print a statement that includes "welcome to age calc"
Alt Text
second, we will make a variable called x and assign it to an input function "please enter your birth year :\n" an convert the type of input to integer
!NOTE!:\n for making a new line
Alt Text
After that we will define a function and call it calc by using :def calc(x=x,y=2020)
after that we will return y-x
and call the function in print statement
Alt Text
thanks for reading , peace.

Top comments (1)

doublepicebs profile image

Really nice!! Would be better if you used something like

import datetime
time =

and let the y to be time.year