Code Review Request: Frida Kahlo Project

Hello! Like probably many folks in this subtopic, I’m working through the Data Science Analytics path and have completed the Frida Kahlo Project. I live in the US and enjoy making homemade pizza :pizza:

I’m getting some practice requesting code reviews and thank you, gentle reader, in advance for your patience and wisdom. With that out of the way, here’s my request for code review.

strong text
The instructions tell us to “append each painting individually… as tuples” but I found some documentation on .extend() – I got the outcome I wanted, but are there any ‘gotchas’ in using this method that I should be aware of?

Task 4
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. (emphasis mine)

new_paintings = [('The Broken Column', '1944'), ('The Wounded Deer', '1946'), ('Me and My Doll', '1937')]
paintings.extend(new_paintings)
print(paintings)

Well, the instructions say to add as a tuple. So, I would do that. BUT, you also did your own research and figured out another way to complete the step (which is good, b/c hooray, learning).

See:

There is a difference between tuples and lists and I’d suggest reading up on that too.
tuples are immutable, lists are mutable.

More, here:

and, here on SO: