Question: def multiply_list (values): ------------------------------------------------------- Multiplies the value of each element of values by its index. Use: multiply_list(values) ------------------------------------------------------- Parameters: values - list of elements
def multiply_list(values):
"""
-------------------------------------------------------
Multiplies the value of each element of values by its index.
Use: multiply_list(values)
-------------------------------------------------------
Parameters:
values - list of elements to multiply (list of int)
Returns:
None
-------------------------------------------------------
"""
# Your code here
return
Complete the function multiply_list in the t06_functions.py module. The module t06.py provides simple testing for this function.
Given a list of integers as a parameter, this function updates the values in the list by multiplying each value by the index of its location in the list. (i.e. the value at index 0 is multiplied by 0, the value at index 1 by 1, the values at index 2 by 2, and so on.)
Some examples from executing t06.py:
before function: [1, 2, 3, 4, 5] multiply_list([1, 2, 3, 4, 5]) after function: [0, 2, 6, 12, 20]
Requirements
This function must:
- update the contents of the list in place, i.e. it must not return a new list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
