Question
Task 1 Input from the user User input is an important part of any program. Remember, programs need to take input, store the data, process
Task 1 Input from the user User input is an important part of any program. Remember, programs need to take input, store the data, process the information, and output to data to a file or display. Python has a simple way to get information from the users keyboard. The input command is used to pull information, as a string, into a variable. Open the Python 3.10 Integrated Development Learning Environment (IDLE) and create a new project named, IDinput. Lets start off by adding your StudentID to the program, then asking the user for their birth date print() birthdate = input(What is your birthdate (MM/DD/YYYY)? ) Task 2 Write the program In this task you will use the input statement to pull data from the user while the program is running. Open the Python 3.10 Integrated Development Learning Environment (IDLE) and create a new project named, Birthday Lets start off by adding your StudentID to the program, then asking the user for their birth date print() birthdate = input(What is your birthdate (MM/DD/YYYY)? ) Now lets print out their birthdate to the screen print(birthdate) Run the program and make sure you can enter a date which is then printed out to the screen. Try running the program again but enter something else (not a date). What happens? Lets split out the MM, DD, and YYYY from what the user input Type: month, day, year = birthdate.split(/) This will split the birthday into month, day, and year. Add the following statement so we can check that everything is working print(month, day, year) Now you are going to convert your month, day, and year into a date number your computer can recognize. To do this we must first import the module datetime into the program Add the following statements to the program: bdate = datetime.datetime(int(year), int(month), int(day)) print(bdate) Unfortunately, that doesnt work because we havent imported the datetime module. At the top of the program add import datetime Your program should now run and show you the date and time for the entered birthday. Now you can do the math to determine the users age. Enter the following statements todays_date = datetime.datetime.now() age = todays_date bdate print(age.days) This will give you the number of days old you are. Finally, you are going to convert the number of days to years by typing the following print (You are + str(age.days/365.25) + years old) We are dividing the total number of seconds by 365.25 which is the total number of days in a year. Take a screenshot of your current program. Run the program and take a screenshot of your final age. Take a screenshot. Deliverables for Task 2 Answer question about invalid input Screenshot of your birthday program and the results of running your program. Task 3 Writing letters with Turtle graphics In this task you will be writing letters to the turtle graphics screen. This can be cone in a couple of ways. The first is to simply add turtle.write to your Python program. Enter the following: You can also change the color and style of the words written to the turtle screen. Change the program to the following: It is also possible to have the turtle draw letters individually. Lets try a new program As you can see this is a bit of a pain but you can put the letters into their own functions and call them as needed. Lets try a second letter (the letter I). Add the following to the bottom of your program. Unfortunately, the two letters are run together so we need to separate them with a space. Add the following lines between you H and I in the program. Now when you run the program you should see a normal message appear on the screen. Take a screenshot of your completed message.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started