Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON 3 PLEASE 1. Write a Python program that declares two lists. a. Set the values in the first list to [-3, 0, 3, 6]

image text in transcribed

PYTHON 3 PLEASE

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 append each value the user enters into the list 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 list 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

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

Step: 3

blur-text-image

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions