Question: Instructions Practice with loops Write a python program that performs the following operations. Note that if I change the input list, your program should

Instructions 

 

Practice with loops

Write a python program that performs the following operations.  Note that if I change the input list, your program should perform the correct operation on the new list that I give it.

Use a loop to accomplish these tasks.

Task 1: Put these numbers in a list and use the * operator to find the third power each of them, putting the result in a new list (hint: use a loop):

9, 5, 8, 2, 1, 12, 3

So, the first three items of the new list should be: 729, 125, 512 ....

 
Task 2: Remove all occurrences of the number 20 from the following list, using only a loop, an "if" and the list access operator (no special list functions):

list1 = [5, 20, 15, 20, 25, 50, 20]

Step by Step Solution

3.40 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Certainly Heres a Python program that accomplishes both tasks us... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!