Dictionaries: Key-Value Pairs; submission error

Mission Link: https://app.dataquest.io/m/314/dictionaries-and-frequency-tables/5/key-value-pairs

My code:

d_1 = {"key_1" : "first_value", "key_2" : 2, "key_3" : 3.14 "key_4" : True, "key_5" : [4,2,1], "key_6" : {"inner_key" : 6}} error = True

Error received:

File "<ipython-input-1-8c2296c09720>", line 4 "key_4" : True, ^ SyntaxError: invalid syntax


I get the above error with the code above, but my code looks exactly like the answer code provided in the lesson, except that I’m using double quotes and putting a space between the key and the :

Answer Code:

d_1 = {'key_1': 'first_value', 'key_2': 2, 'key_3': 3.14, 'key_4': True, 'key_5': [4,2,1], 'key_6': {'inner_key' : 6}} error = True

Can you tell me what I’m doing wrong? If I start with the answer code and change single quotes to double quotes, and add a space between the key and : it works.

Hi Sean, welcome to the forums!

It looks like you’re missing a comma in your dictionary between key_3 and key_4: "key_3" : 3.14 "key_4" : True. :wink:


Lol. I thought I counted all the commas! Apologies for the ridiculous question!

No worries! After a while all those commas and spaces and indents make you go bug-eyed. :crazy_face: