Python exercise ex39 question

Hi,
I got stuck in exercise 39; dictionary using the list() function. I’m always getting syntax error pointing at the colon symbol. I read and search about using a colon on “list”, it seems like it’s for use slice method. I rewrote many times but it always syntax error. I don’t know what I’m missing. Please advise.

1 # create a mapping of state to an abbreviation
2 states = [
3                'Oregon': 'OR',
4                'Florida': 'FL',
5                'California': 'CA',
6                'New York': 'NY',
7                'Michigan': 'MI'
8 ]

Thanks,

You must have an older version of the book that got the code wrong by the publisher. It should be this:

1 # create a mapping of state to an abbreviation
2 states = {
3                'Oregon': 'OR',
4                'Florida': 'FL',
5                'California': 'CA',
6                'New York': 'NY',
7                'Michigan': 'MI'
8 }

See how I changed the [ and ] characters to { and }?

Thank you for replying to my question. Actually that’s what I did I change the square bracket with the curly one’s and my code work. But this information is great because it confirms my thinking that it could have been a typo.