Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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 dedlared. 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 varia ble 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 neednt 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. 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 d. Hint: Get the code to work without worrying about the print formatting first

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

You have

Answered: 1 week ago