Code review for Frida Kahlo Project

Hello, I was wondering if anybody would be willing to look at my code for the Frida Kahlo Project. Let me what works and what would could be done better.

Thanks,

Nathaniel Bowes

Blockquote# coding: utf-8

In[1]:

paintings = [‘The Two Fridas’, ‘My Dress Hangs Here’, ‘Tree of Hope’, ‘Self Portrait With Monkeys’]

In[2]:

dates = [1939, 1933, 1946, 1940]

In[3]:

paintings = list(zip(paintings, dates))

In[4]:

print(paintings)
[(‘The Two Fridas’, 1939), (‘My Dress Hangs Here’, 1933), (‘Tree of Hope’, 1946), (‘Self Portrait With Monkeys’, 1940)]

In[5]:

paintings.append((‘The Broken Column’, 1944))

In[6]:

paintings.append((‘The Wounded Deer’, 1946))

In[7]:

paintings.append((‘Me and My Doll’, 1937))

In[8]:

print(paintings)
[(‘The Two Fridas’, 1939), (‘My Dress Hangs Here’, 1933), (‘Tree of Hope’, 1946), (‘Self Portrait With Monkeys’, 1940), (‘The Broken Column’, 1944), (‘The Wounded Deer’, 1946), (‘Me and My Doll’, 1937)]

In[9]:

print(len(paintings))
7

In[11]:

audio_tour_number = list(range(1,8))

In[12]:

master_list = list(zip(audio_tour_number, paintings))

In[13]:

print(master_list)
[(1, (‘The Two Fridas’, 1939)), (2, (‘My Dress Hangs Here’, 1933)), (3, (‘Tree of Hope’, 1946)), (4, (‘Self Portrait With Monkeys’, 1940)), (5, (‘The Broken Column’, 1944)), (6, (‘The Wounded Deer’, 1946)), (7, (‘Me and My Doll’, 1937))]

1 Like

hello, I just started doing this course and I also just finished this project
I think the code is good

but I did the requirements number 6 differently, the ( 6. Use the range method 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_number and check your work by printing the list.)

like this : audio_tour_number = range(1,len(paintings)+1) , so it will use the list length instead of putting manually

Hello!

We did almost exactly the same code, with only two differences.

1st difference:
I commented every step of the code, so it would be easier for anyone to understand what I did, especially myself.

2nd difference:
Instead of appending each new painting, I joined the first zipped list to a new list with the other paintings. I know the instructions used the word “append”, what could be interpreted as a clue to use the append method, but I think it’s cleaner and more time efficient to add multiple items using a simple “+” sign.

In case you’re having trouble to visualize what my code looks like, I’m sharing it with you down here. Feel free to comment, I’d love to hear what you think about it.

# Defining first lists:

paintings = ['The Two Fridas', 'My Dress Hangs Here', 'Tree of Hope', 'Self Portrait With Monkeys']
dates = [1939, 1933, 1946, 1940]

# Joining lists:

zipped_list = list(zip(paintings, dates))
print(zipped_list)

# Appending new paintings list:

zipped_list = zipped_list + [('The Broken Column', 1944), ('The Wounded Deer', 1946), ('Me and My Doll', 1937)]
print(zipped_list)

# Verifying amount of paintings:

print(len(zipped_list))

# Creating id for each painting:

audio_tour_number = list(range(1,8))
print(audio_tour_number)

# Pointing id's to paintings:

master_list = list(zip(audio_tour_number, zipped_list))
print(master_list)

Nice work. :slight_smile: I did number 11 different for the range method, and it also worked. I added the count + 1, so it would accommodate for future, if a painting was added, as opposed to hard-coding in the number 8.

count = len(paintings)

print(count)

audio_tour_number = range(1, count+1)