Code Review: Frida Kahlo Project

Hi people,

Does anyone want to review my code?

I have finished the Frida Kahlo Project on Jupyter Notebook. I uploaded it to this topic/thread
It was part of the data analytics carreer path and made in the Python language.

Does anyone has a [similar] code that needs to be reviewed? Let me know!

The code:
frida_project.txt (4.7 KB)

Hey,

I just finished the Frida Kahlo Project as well. I can take a look at your code and do the review. Would you mind taking a look at mine as well?

I am currently in the Data Scientist: Natural Language Processing Specialist path. I have completed 20% of the path so far and have really been enjoying it. How has your experience been with your path?

Yes i can look at yours at well. Have you a link to the project or have you opened a topic?

I am 33% on the career path of Business Intelligence Data Analyst, but it overlaps with other paths i think because increased few percent in other paths as well.

I understand everything so far, but some parts are hard to memorise, which code to use when and what the longer codes mean

I currently can’t add any attachments since I am new but I have copied my code to this reply so hopefully everything looks fine on your end. I will take a look at your code and do the review. Thank you for taking the time to take a look at my code.

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 paintings and 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 dates and 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 paintings variable. Make sure to
convert the zipped object into a list using the list() function. Print
the results to the terminal to check your work.

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

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

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 paintings list 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))
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 Broken Column', 1944), ('The Wounded Deer', 1946), ('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 paintings list.

len_of_paintings = len(paintings)
print(len_of_paintings)

8

Task 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.

audio_tour_number = list(range(9))
print(audio_tour_number)

[0, 1, 2, 3, 4, 5, 6, 7, 8]

Task 7

We’re finally read to create our master list. Zip the audio_tour_number
list to the paintings list and save it as master_list.

Hint: Make sure to convert the zipped object into a list using the
list() function.

master_list = list(zip(audio_tour_number, paintings))

Task 8

Print the master_list to the terminal.

print(master_list)

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

My feedback

  1. Even if they dont ask for it, it is good to always add a print() function in a line after your code. that way you can check if the code works and if it gives the right results. An example is task 1 and task 2. These tasks dont have a print request
  2. Task 4 it seems you did it in an easier way than i did. you can look at my code i used a lot of more code to answer it but i think less code for the same answer is better
1 Like

Thank you for the feedback! Yeah I should probably be using the print function just to make sure everything is working out correctly.

Here is my feedback.

As you mentioned in your feedback on my code, the only thing I really see is that task 4 could have been answered with a lot less code. It seems that when you added the two new variables, paintings_3extra and dates_3extra, it looks like it made 2 different lists inside the paintings list once you used the zip function to add them to the list. It also did not add the dates correctly to the paintings associated with them. In task 5 however it looks like you corrected all that and got the list looking exactly how it should.

1 Like