Question: Write a function, listMultiples, that takes a list, values, and a number as parameters and then multiplies each element of the list by the given

Write a function, listMultiples, that takes a list, values, and a number as parameters and then multiplies each element of the list by the given number and returns the updated list.
Use a while loop to go through the list and update the values. (see 6.9 for multiply function example). As before, we use the condition while < length of the list to scroll through the list. Also see 6.1 Accessing List Elements as you will need to replace each existing value with the multiplied value. You will need to use the i in the [] of your list.
Ex: If the values list is:
[2,3,5,7,11]
and the number is 5, the returned list would be:
[10,15,25,35,55]
You do not need a main function or to print anything. Only write the function with a returned list.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!