name = input("what is your name? ")
print ("Greeting" + " " + name)
birthyear = input("enter your birth year: ")
age = 2023 - int (birthyear)
print ("Your Age is:")
💡 First we are taking the name of the user whose age we want to calculate and display to him/her.
💡 As you seen we have printed the name (variable) with a Greeting message and given an "Empty Space" between Name and Greeting.
💡 To create a Empty Space we use " " (space in the middle of quotes.) in Python.
💡 Next we are taking input from the user (his age.)
💡 Python by default treats every input as a string, so to tell the compiler that the user input is a integer type value (not a string!), we are usin int data type.
ex. Here: int(birthyear)
💡 We are substracting the current year (i.e. 2023) to the value user has given in the input (i.e. birthyear), and the results are being passed to the variable called age.
💡 Finally we are printing a message to the user and in next line we are printing his age.