1. Write a Python program that declares two lists. a. Set the values in the first...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Write a Python program that declares two lists. a. Set the values in the first list to [-3, 0, 3, 6] by initializing on the line where the list is declared. Print the elements of the list using fields 3 characters wide for each element. b. Build the first list up to [-3,0,3, 6] by starting with an empty list and using a counting loop whose loop index variable goes from 1 to 4 and finding a formula that converts the loop variable into the needed values. Use the append member function of the list to add to the list. (Spend some time thinking about this, as it may be useful later.) Print the list using fields 5 characters wide for each element. c. Declare an empty list. Use a loop and, within it, prompt the user for integer values (they needn't be the ones from parts a and b) and add each value the user enters into the first array directly. After each number is entered, ask the user whether or not to continue. After the user chooses not to enter more numbers, print the list. d. Use a loop to fill a second array with the values from the first array from part c) in reverse order. Print the second array. Hint: Get the code to work without worrying about the print formatting first. 1. Write a Python program that declares two lists. a. Set the values in the first list to [-3, 0, 3, 6] by initializing on the line where the list is declared. Print the elements of the list using fields 3 characters wide for each element. b. Build the first list up to [-3,0,3, 6] by starting with an empty list and using a counting loop whose loop index variable goes from 1 to 4 and finding a formula that converts the loop variable into the needed values. Use the append member function of the list to add to the list. (Spend some time thinking about this, as it may be useful later.) Print the list using fields 5 characters wide for each element. c. Declare an empty list. Use a loop and, within it, prompt the user for integer values (they needn't be the ones from parts a and b) and add each value the user enters into the first array directly. After each number is entered, ask the user whether or not to continue. After the user chooses not to enter more numbers, print the list. d. Use a loop to fill a second array with the values from the first array from part c) in reverse order. Print the second array. Hint: Get the code to work without worrying about the print formatting first.
Expert Answer:
Answer rating: 100% (QA)
Solution a list1 3 0 3 6 for e in list1 print3dformate e... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
In an organization that has high employee satisfaction, ______. Multiple choice question. customer interactions are forced and scarce employee turnover is high more positive interactions take place...
-
Use the F table to approximate the following probabilities. a. P (F(10,8) 3.35) b. P (F(10,8) < 0.42) c. P (F (10,8) 4.30) d. P (F(10,8) < 0.26)
-
The spring in FIGURE EX10.23a is compressed by Îx. It launches the block across a frictionless surface with speed v 0 . The two springs in FIGURE EX10.23b are identical to the spring of Figure...
-
The Anchor Glass Container Corporation and its parent company, Consumers Packaging, Inc. (CPI), entered into a series of agreements with Encore Glass, Inc., to supply glass containers of a specific...
-
Anna Schaub, the financial manager at the Mangiamo restaurant, is checking to see if there is any relationship between newspaper advertising and sales revenues at the restaurant. She obtains the...
-
About a year and a half ago, your parents purchased some appliances at a major retailer, taking advantage of a "no payments and no interest offer. Under the agreement, for 18 months no interest would...
-
27. The total possible stereoisomers of the given compound CH 3 (a) two (b) three H (c) one (d) four
-
How to compute the Net Profit Margin in San Miguel Corporation's 2021 Annual Report?
-
Give a detailed introduction of Duck race company Calgary. and also some information of their partners big brothers big sisters and Rotary club. The background demonstrates an understanding of your...
-
The following analysis was done on a fork lift that is owned by Angelico Co. Year Marginal Cost Total AW PW Sum PW $/yr 0 1 6000 $5,581.40 $5,581.40 $6,000.00 2 6025 $5,213.63 $10,795.02 $6,012.05 3...
-
What is the present value at retirement of his required retirement income before tax?
-
What are the two underlying nonlow vowel phonemes and state the rules accounting for the distribution of their allophone?
-
In most cases, local managerial approaches must be modified when doing business overseas. What are three specific examples that support this statement? Be complete in your answer
-
Before the latest financial crisis and recession, when was the largest recession of the past 50 years, and what was the cumulative loss in output over the course of the slowdown?
-
If Charles, a 16-year-old child model, earns $50,000 a year and is completely self supporting even though he lives with his parents, can his parents claim him as a dependent? Why or why not?...
-
Bea Jones (age 32) moved from Texas to Florida in December 2011. She lives at 654 Ocean Way, Gulfport, FL 33707. Bea's Social Security number is 466-78-7359 and she is single. Her earnings and income...
-
Bill and Guilda each own 50 percent of the stock of Radiata Corporation, an S corporation. Guilda's basis in her stock is $25,000. On July 31, 2012, Bill sells his stock, with a basis of $40,000, to...
-
Discuss the importance of validity and research design. Next, choose one type of validity (internal, external, construct, or statistical conclusion) and discuss its relevance to experimental, quasi...
-
Explain from a technical viewpoint why it is important to distinguish a method, research, approach, and design. Next, briefly discuss how understanding each term individually in addition to how these...
-
Define the two major types of sampling strategies .
Study smarter with the SolutionInn App