asked 234k views
1 vote
For this project, you will be developing a PY file that contains your code in PyCharm and evaluating a few of the features of PyCharm. If you haven’t already, be sure to install the PyCharm IDE and Python on your computer. Review the tutorials in the Module Two resources to help you install and get started with PyCharm.

In PyCharm, write a program using python 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:

What is your name? Amanda
How old are you? 15

Hello Amanda! You were born in 2005.

asked
User Brother
by
9.0k points

1 Answer

4 votes

import datetime

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

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

year = datetime.datetime.today().year

print("Hello {}! You were born in {}.".format(name, year - age))

I hope this helps!

answered
User Jay Zuo
by
8.0k points

Related questions

asked Oct 3, 2024 19.1k views
Surfearth asked Oct 3, 2024
by Surfearth
8.4k points
1 answer
2 votes
19.1k views
asked May 28, 2024 2.3k views
Glenn Gordon asked May 28, 2024
by Glenn Gordon
7.6k points
1 answer
1 vote
2.3k views