Question: Assume the following statement appears in a program: names = [ ] Which of the following statements would you use to add the string Wendy

Assume the following statement appears in a program:

names = [ ]

Which of the following statements would you use to add the string ‘Wendy’ to the list at index 0? Why would you select this statement instead of the other?

a. names[0] = 'Wendy'

b. names.append('Wendy')

Step by Step Solution

3.42 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

You would use statement b ... View full answer

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 Starting Out With Python Questions!