Learning Python

  • 2 Replies
  • 51 Views
*

Codeguy

  • *
  • 19748
  • Who is Ron Vara?
Learning Python
« on: October 24, 2025, 05:04:24 PM »
OK, any tech geeks out there? I'm learning Python and this is giving me problems: Spot the error in the following python statement:

U2_albums = {
    "Boy": 1980,
    "October": 1982,
    "WAR": 1983,
    "The unforgettable Fire": 1984,
    "The Joshua Tree": 1987,
    "Rattle and hum": 1988,
    "Achtung Baby": 1991,
    "Zooropa": 1993,
    "Passengers:OST1": 1995,
    "POP": 1997,
    "All That You Can't Leave Behind": 2000,
    "How to dismantle an atomic bomb": 2004,
    "No line on the Horizon": 2009,
    "Songs of Innocence": 2014,
    "Songs of Experience": 2017
}

Syntax error: Invalid dictionary value


Any ideas?
-------

Who is Ron Vara?

*

Tumbling Dice

  • Status: Experienced Mofo
  • *****
  • 9060
  • Dice Dice Baby
Re: Learning Python
« Reply #1 on: October 24, 2025, 11:09:33 PM »
Passengers has ceased to be.

The future is bright at Everton FC  8)

*

Codeguy

  • *
  • 19748
  • Who is Ron Vara?
Re: Learning Python
« Reply #2 on: October 25, 2025, 12:56:09 AM »
Passengers has ceased to be.

Hmmm. OK, I'll try to run the code without it.

U2_albums = {
    "Boy": 1980,
    "October": 1982,
    "WAR": 1983,
    "The unforgettable Fire": 1984,
    "The Joshua Tree": 1987,
    "Rattle and hum": 1988,
    "Achtung Baby": 1991,
    "Zooropa": 1993,
    # "Passengers:OST1": 1995,
    "POP": 1997,
    "All That You Can't Leave Behind": 2000,
    "How to dismantle an atomic bomb": 2004,
    "No line on the Horizon": 2009,
    "Songs of Innocence": 2014,
    "Songs of Experience": 2017
}


Yup, I commented out Passengers and I'm all good to go.  ;D ;D ;D
-------

Who is Ron Vara?