Question: Consider there is a list i.e. listA = {20, 10, 5, 15, 3} Write python code that: a. Creates a function updateListA(), which takes listA
Consider there is a list i.e.
listA = {20, 10, 5, 15, 3}
Write python code that:
a. Creates a function updateListA(), which takes listA as input parameter, adds 30 after 20, and adds 40 at the end of the listA. [Hint: create a parameterized function]
[01]
b. Creates a function newList(), which takes listA as input parameter and creates a new list newList with same elements as listA but in reverse order. [01]
c. If there is a function defined as below: def example(par1, par2=30):
print(valid)
From the following function calls:
i. example(par1=1) ii. example(1, 2) iii. example(par2=1) iiii. example(par1=5, par2=6) Which call is valid? Write the values of par1 and par2 if a call is valid? Suggest corrections if a call is invalid.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
