Question: I am using python 8.) 1 point Let's define the following function: def addToList (x, myList): if x is not None: if x not in
I am using python
8.) 1 point Let's define the following function: def addToList (x, myList): if x is not None: if x not in myList: myList.append (x) return What purpose does the first if statement serve? 9.) 1 point Again, with reference to the function defined in question 8, what purpose does the second if statement serve? 10.) 1 point Assuming we have defined the function addToList as seen above, let's define a list called someNumbers like this >>> someNumbers = [] >someNumbers.append (42) >someNumbers.append (19) >>someNumbers.append (50) >>someNumbers.append (14) >>>someNumbers.append (1) What are the contents of the list someNumbers after we the following twoO function calls? >>addToList (3, someNumbers) >>>addToList (3, someNumbers) For 2 bonus points: explain these results. At this point, why does our list someNumbers contain the values that it does
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
