Chapters
Python114 chapters

Exercises

Add Items

3 tasks. Write the code, press Check, and the page runs it against a real Python interpreter.

Exercise 1

Add Grace and Katherine to the list so it ends up with three names.

Python
names = ["Ada"]
# add the other two
print(names)
Exercise 2

Put Grace between Ada and Katherine using insert.

Python
names = ["Ada", "Katherine"]
# insert Grace in the middle
print(names)
Exercise 3

This throws the list away. Fix it so names ends up with both items.

Python
names = ["Ada"]
names = names.append("Grace")
print(names)