I am from Croatia. This is my first post here. I am currently at 21% of the Data Scientist: Machine Learning path. I have completed the Frida Kahlo Project and am happy with most of the results, but I would love to hear your suggestions on improving the code.
paintings = ['The Two Fridas', 'My Dress Hangs Here', 'Tree of Hope', 'Self Portrait With Monkeys']
dates = [1939, 1933, 1946, 1940]
# zipping paintings with their dates
paintings = list(zip(paintings, dates))
print(paintings)
# appending additional paintings to paintings list
paintings.extend([('The Broken Column', 1944), ('The Wounded Deer', 1946), ('Me and My Doll', 1937)])
print(paintings)
# adding unique identifiers to paintings
print(len(paintings))
audio_tour_number = range(1, len(paintings) + 1)
master_list = list(zip(audio_tour_number, paintings))
print(master_list)
thank you for the help.
Yes, you are correct instruction do tell to use the .append() but I was going here beyond the instructions to improve the code.
Regarding the range, maybe I misunderstood you but do you not have both arguments?
Hey, your code is really easy to follow and read because of the well-written comments.
master_list outputs a nested list. This is inevitable if you follow the instructions. But a flat structure would be easier to read and reference. For a flat structure (i.e ID, Painting, Date), you’d need to either a) comment out Task 3 and zip paintings, dates and audio_tour_number or b) unpack the paintings tuple before zipping in Task 7.