I’m just following instructions. The code works fine, but would love to hear any more elegant solutions. Also, what’s the best way to share a Jupyter notebook file? I copy and pasted the assignment from a Python clipboard. Looks weird.
Thanks for you help,
# Frida Kahlo Exhibition
You’ve been hired to work on a retrospective of Frida Kahlo’s work at a major museum. Your job is to put together the audio tour, but in order to do that you need to create a list of each painting featured in the exhibit, the date it was painted, and its spot in the tour.
Use your knowledge of Python lists to create a master list of each painting, its date, and its audio tour ID.
## Task 1
First, create a list called
paintingsand add the following titles to it:
The Two Fridas, My Dress Hangs Here, Tree of Hope, Self Portrait With Monkeys
paintings=[“The Two Fridas”, “My Dress Hangs Here”, “Tree of Hope”, “Self Portrait With Monkeys”]
## Task 2
Next, create a second list called
datesand give it the following values:
1939, 1933, 1946, 1940
dates=[1939, 1933, 1946, 1940]
## Task 3
It doesn’t do much good to have the paintings without their dates, and vice versa.
Zip together the two lists so that each painting is paired with its date and resave it to the
paintingsvariable. Make sure to convert the zipped object into a list using the
list()function. Print the results to the terminal to check your work.
## Task 4
There were some last minute additions to the show that we need to add to our list. Append the following paintings to our
paintingslist then re-print to check they were added correctly:
- ‘The Broken Column’, 1944
- ‘The Wounded Deer’, 1946
- ‘Me and My Doll’, 1937
Hint: Make sure to append each painting individually and that you’re appending them as tuples, not lists.
paintings.append((“The Broken Column”, 1944))
paintings.append((“The Wounded Deer”, 1946))
paintings.append((“Me and My Doll”,1937))
## Task 5
Since each of these paintings is going to be in the audio tour, they each need a unique identification number.
But before we assign them a number, we first need to check how many paintings there are in total.
Find the length of the
## Task 6
rangemethod to generate a list of identification numbers that starts at 1 and is equal in length to our list of items.
Save the list to the variable
audio_tour_numberand check your work by printing the list.
audio_tour_number=[n+1for n in range(8)]
## Task 7
We’re finally read to create our master list.
audio_tour_numberlist to the
paintingslist and save it as
Hint: Make sure to convert the zipped object into a list using the
## Task 8
master_listto the terminal.
for painting in master_list: