Frida Kahlo Retrospective Off-Platform Project

https://www.codecademy.com/paths/machine-learning-ai-engineering-foundations/tracks/mlef-python-fundamentals-for-ml-ai-engineers/modules/mlef-frida-kahlo-cumulative-project/projects/frida-kahlo-retrospective-project

Not sure why I am getting this error on this code:, if I remove the last print statement, it works. It also works fine in Sublime text, just not on the platform.

File “script.py”, line 14

                 ^

SyntaxError: unexpected EOF while parsing

This is what the code looks like:

#1 paintings = ['The Two Fridas', 'My Dress Hangs Here', 'Tree of Hope', 'Self Portrait With Monkeys'] #2 dates = [1939, 1933, 1946, 1940] #3 merged = list(zip(paintings, dates)) print(merged) #4 merged.append("'The Broken Column',1944") merged.append("'The Wounded Deer', 1946") merged.append("'Me and My Doll', 1937") #5 print(len(merged)

Then when I try to add the rest of the code I get Syntax error:

#1 paintings = ['The Two Fridas', 'My Dress Hangs Here', 'Tree of Hope', 'Self Portrait With Monkeys'] #2 dates = [1939, 1933, 1946, 1940] #3 merged = list(zip(paintings, dates)) print(merged) #4 merged.append("'The Broken Column',1944") merged.append("'The Wounded Deer', 1946") merged.append("'Me and My Doll', 1937") #5 print(len(merged) #6 audio_tour_number = range(7) print(audio_tour_number) #7 master_list = list(zip(merged)) #8 print(master_list)

can someone explain why? I’m really not sure why it would say variable = range(x,y) would be wrong syntax. I’ve looked for it on external forums but the syntax seems okay?

File “script.py”, line 15
audio_tour_number = range(7)
^
SyntaxError: invalid syntax

1.) The error/clue: invalid syntax

Double check the use of quotes here:

merged.append("'The Broken Column',1944")
merged.append("'The Wounded Deer', 1946")
merged.append("'Me and My Doll', 1937")

Also: aren’t the items that you’re adding missing something else?
Hint: [ ]

And, double check your use of parentheses at the end of your code with the print()

2.) to create a list & using the sequence type range():
you’re not quite using it correctly. It has 3 parameters, start, stop, and step which is optional:

The question asks:
" 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."

So, you have this:
audio_tour_number = range(7)

How would you fix that?

1 Like