Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

5. Describe the visual representations, or models, of communication

Answered: 1 week ago