Your Python program will do the following: Create an empty list, called first names Create another...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
Here are Python programs for both Part 1 and Part 2 of your assignment Part 1 Part ... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
For the beam and loading shown, use discontinuity functions to compute: (a) the deflection VA of the beam at A, and (b) the deflection Vmidspan of the beam at midspan (i.e., x = 2.7 m). Assume a...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
This exercise is meant to help you to understand how to use functions in Python. In this week's exercise, you are asked to create a simple tool that converts temperatures from one temperature type to...
-
You are the manager of a firm that produces products X and Y at zero cost. You know that different types of consumers value your two products differently, but you are unable to identify these...
-
Prove that for any vectors u, v, and w in R2 or R3 and any scalar c, we have (a) (u + cv) w = u w + c(v w); (b) u (cv) = c(u v); (c) (u + v) (cw) = c(u w) + c(v w).
-
It is important for service providers and teachers of students with moderate to severe disabilities to collaborate and communicate clearly with one another to ensure the needs of the students are...
-
The 2015 annual report of The Procter & Gamble Company (P&G) is available at www.pginvestor.com. After reviewing P&Gs annual report, respond to the following questions: a. P&Gs 2015 statement of cash...
-
Brill Products, located in Forest Lake, Minnesota, produces two lines of electric tooth-brushes: Deluxe and Standard. Because Brill can sell all of the toothbrushes it produces, the owners are...
-
The following is selected simplified information from Organic Catering s balance Sheet as at December 3 1 , 2 0 2 3 and December 3 1 , 2 0 2 4 . ( Round the final answer to two decimal places. ) (...
-
A base band digital transmission system that sends A-valued rectangular pulses through a channel at a rate of 20,000 bps is to achieve an error probability of 10 -6 . If the noise power spectral...
-
In a free-market economy, what is the function of the price?
-
Determine the missing amounts. (Round percentages to O decimal places, e.g. 52%.) Unit Selling Price 1. 2. 3. $ Unit Variable Costs Unit Contribution Margin Contribution Margin Ratio $610 $325 $920 $...
-
Blossom Corp. will pay dividends of $5.00, $6.25. $4.75, and $3.00 in the next four years. Thereafter, management expects the dividend growth rate to be constant at 5 percent. If the required rate of...
-
Undertake a comprehensive landscape analysis of the operating environment ( both internal and external) that your organizations are currently operating. Discuss how the factors you have identified...
-
5) Megan and four of her friends plan to go for a long drive. She buys 12 bottles of frappe and a few bottles of orange juice from a supermarket. The total number of bottles they have are four times...
-
At December 31, 2022, the trading debt securities for Sunland, Inc. are as follows. Security Cost Fair Value $17,800 $16,300 B 12,900 14,400 C 23,300 18,700 $54,000 $49,400 (E) Your Answer Correct...
-
After the Seneca IT team performed hardware upgrades to the computers in a Seneca lab, several computers are beeping when powered on. The pattern is one long and two short beeps. You find out these...
-
CRUZ, INC. Comparative Balance Sheets December 31, 2015 CRUZ, INC. Income Statement For Year Ended December 31, 2015 Required Use the indirect method to prepare the cash provided or used from...
-
Define the Triangle2D class that contains: Three points named p1, p2, and p3 of the type MyPoint with getter and setter methods. MyPoint is defined in Exercise. Design a class named MyPoint to...
-
Suppose that the text file on the Web http://cs.armstrong.edu/liang/data/Scores.txt contains an unspecified number of scores. Write a program that reads the scores from the file and displays their...
-
Listing 20.7, DirectorySize.java, gives a recursive method for finding a directory size. Rewrite this method without using recursion. Your program should use a queue to store the subdirectories under...
-
Folk Landscaping is evaluating an offer to purchase Bruce Lawn Care, its main competitor, for \($250,000.00.\) An accountant has projected that the purchase will increase Folks annual net cash flow...
-
How much do we need to invest each year to have \($100,000.00\) in a college fund when our child turns 18 years old? New parents often seek similar advice from their financial advisors to establish...
-
Forester Company is evaluating the purchase of equipment from two vendors. Differences in the technology and labor requirements to operate the equipment of each vendor affect the projected net cash...
Study smarter with the SolutionInn App