In pycharm, write a program that prompts the user for their name and age. Your program should then tell the user the year they were born. Here is a sample execution of the program with the user input in bold:

Respuesta :

Answer: See below

Explanation:

#method to calculate the year of birth

def year_of_birth(age):

   return 2020-age

if __name__=="__main__":        # executing the code using this format if the file is run directly.

   

  #Asking the user to enter his or her name

   your_name = input("What is your name?")  

 

  #Asking user to enter his or her age

   your_age = int(input("How old are you?"))

  #Computing the year of birth using the fuction year_of_birth and store the result in your born in variable

   your_born_in=year_of_birth(your_age)

   

  #Displaying our results                                            

   print("Hello", your_name + "!", "You are born in " + str(your_born_in) + ".");

Happy coding!