Page 49 -
P. 49
meet python
Let’s take a bit of time to try to work out which strategy to use when adding data to your list in
this case.
Given the following list-creation code:
movies = ["The Holy Grail", "The Life of Brian", "The Meaning of Life"]
1 Work out the Python code required to insert the numeric year data into the preceding list,
changing the list so that it ends up looking like this:
["The Holy Grail", 1975, "The Life of Brian", 1979, "The Meaning of Life", 1983]
Write your
insertion
code here.
2 Now write the Python code required to re-create the list with the data you need all in one go:
Write your
re-creation
code here.
In this case, which of these two methods do you think is best? (Circle your choice).
1 or 2
you are here 4 13