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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!