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
-
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...
-
It can be shown that as a mass m with specific heat c changes temperature from T i to T f its change in entropy is S = mcln (Tf/Ti) if the temperatures are expressed in kelvin. Suppose you put 79 g...
-
Research the parts of the diamond value chain and then answer the following question: How would you describe the type of process used for (a) exploration, (b) diamond mining, (c) sorting and grading,...
-
Sometimes people who act inappropriately are just trying to save their jobs and the company. How do you feel about those types of persons?
-
Frank Weston, supervisor of the Freemont Corporations Machining Department, was visibly upset after being reprimanded for his departments poor performance over the prior month. The departments cost...
-
Write a C program that asks the user to enter the sum and difference of 2 integer numbers. The program will find the 2 numbers and display them as shown below. Input validation: sum plus difference...
-
What is sustainability? How does weak sustainability differ from strong sustainability? To what extent does weak and strong sustainability matter in the formulation of government policy on...
-
An interest rate is given as 5 percent per year nominal. Determine the effective annual rate if a. compounding is annual. b. compounding is daily. c. compounding is continuous.
-
If you deposit $4,000 into an account paying 6 percent per year compounded semiannually, how much will you have in the account after 10 years?
-
If you deposit $5,000 four years from today, how much can you withdraw 10 years from today if interest is 8.5 percent per year compounded annually?
-
In order to pay for school, you borrow $22,000 at 12 percent/year compounded monthly. You do not pay back any of it until the end of the first month following year 4, and you intend to have it paid...
-
With interest at 9 percent compounded annually, what is the fewest number of years (integer-valued) required for money to double in magnitude?
-
A handheld air pump (diameter = 5 cm, length 20 cm) can be used as an atomizer (hole diameter 0.3 cm) to generate a fine mist of paint or pesticide by forcing air at a high velocity through a small...
-
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...
-
Assume a stock is priced at $100; calculate its intrinsic value based on the Gordon growth DDM, with the following assumptions: D0 = $3, g = 6 percent, and k = 10 percent. Indicate whether investors...
-
The simplest sequential description of the Ewens sampling formula is called the Chinese restaurant process. The first customer arrives and is seated at a table. After \(n\) customers have been...
-
Suppose Borg Corporation was operating at 88 percent of capacity. What would sales be at full capacity? What is the EFN in this case? What is the capital intensity ratio at full capacity?
Study smarter with the SolutionInn App