Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mattdimicelli/78f175f357d8c0b5ce1b679f7e49389c to your computer and use it in GitHub Desktop.
Save mattdimicelli/78f175f357d8c0b5ce1b679f7e49389c to your computer and use it in GitHub Desktop.
help with order in dictionary output
def make_album(artist, album_name, songs = None):
''' Makes a dictionary describing a music album'''
if songs:
album = {artist, album_name, songs}
else:
album = {artist, album_name}
return album
album1 = make_album("Guns n' Roses", "The Spaghetti Incident")
print(album1)
album2 = make_album("Pink Floyd", "The Wall", "10")
print(f"\n{album2}")
album3 = make_album("Smash Brothers", "All Stars")
print(f"\n{album3}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment