Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your Python program will do the following: Create an empty list, called first names Create another empty list, called last names Ask the user
Your Python program will do the following: Create an empty list, called first names Create another empty list, called last names Ask the user to enter three full names. (Note that you will want six total inputs: 3 first names and 3 last names). After you get each first name, add it to the end of the first names list. After you get each last name, add it to the end of the last names list. Print the first and last initials for each person by using the names in your lists. You MUST access the names from the list and then access the string. (HINT: Use double-indexing). Your program should look like this when it runs (user input is in red): First person, enter first name: Donald First person, enter last name: Knuth Second person, enter first name: Grace Second person, enter last name: Hopper Third person, enter first name: Alan Third person, enter last name: Turing. First person initials: D.K.. Second person initials: G.H. Third person initials: A.T. Part 2 Your Python program will do the following: Create a list, called squares, and initialize it with the following numbers: 1,4,9,16 Create another list, called threes, and initialize it with the following numbers: 1,8,27,81 Create a variable called all nums. This variable will concatenate the lists squares and threes. Print the sum of all elements of the list all_nums. Create a list, called squares, and initialize it with the following numbers: 1,4,9,16 Create another list, called threes, and initialize it with the following numbers: 1,8,27,81 Create a variable called all_nums. This variable will concatenate the lists squares and threes. Print the sum of all elements of the list all_nums. Print the product of the second element of all_nums and the second-to-last element of all_nums. Your program should look like this when it runs: Sum of all nums: 147 Product of second and second-to-last: 108 Here is an example screenshot of the program running in the IDLE shell: Python 3.8.2 Shell File Edit Shell Debug Options Window Help - X Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AM D64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> == RESTART: C:/Users/rstew/OneDrive/Documents/CIS111/Labs/Lab5/1ab5-sol.py Part 1: First person, enter first name: Donald First person, enter last name: Knuth Second person, enter first name: Grace Second person, enter last name: Hopper Third person, enter first name: Alan Third person, enter last name: Turing First person initials: D.K. Second person initials: G.H. Third person initials: A.T. Part 2: Sum of all nums: 147 Product of second and second-to-last: 108
Step by Step Solution
★★★★★
3.33 Rating (150 Votes )
There are 3 Steps involved in it
Step: 1
Here are Python programs for both Part 1 and Part 2 of your assignment Part 1 Part ...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