Question: Given the following code: 1. def maybeAdd(ch, toList): 2. if ch in 'abcdefghijklmnopqrstuvwxyz' and ch not in toList: 3. toList.append (ch) What is the value
Given the following code:
1. def maybeAdd(ch, toList): 2. if ch in 'abcdefghijklmnopqrstuvwxyz' and ch not in toList: 3. toList.append (ch)
What is the value of MyList after the following code is executed?
>>> myList = [] maybeAdd('a', myList) Question 11 options:
|
|
[]
|
|
|
['a']
|
|
|
['abcdefghijklmnopqrstuvwxy']
|
|
|
None
|
Given the following code:
1. def maybeAdd(ch, toList): 2. if ch in 'abcdefghijklmnopqrstuvwxyz' and ch not in toList: 3. toList.append (ch)
What is the value of myList after the following code is executed?
>>> myList ['a', 'b'] >>> maybeAdd('a', myList)
Question 12 options:
|
|
['a', 'a', 'b']
|
|
|
['a', 'b']
|
|
|
['abcdefghijklmnopqrstuvwxyz']
|
|
|
None
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
