2025-02-21 14:41:04 +00:00

17 lines
576 B
Python

# Exercise 8-7 Album
# Learning Objective: Write a function that returns a dictionary of information about an album.
def make_album(artist_name, album_title, num_tracks=None):
album_info = {'artist': artist_name, 'album': album_title}
if num_tracks:
album_info['number_of_tracks'] = num_tracks
return album_info
newAlbum = make_album('Korn', "Y'all wanna single", 1)
print(newAlbum)
newAlbum2 = make_album('Infected Mushroom', 'Classical Mushroom', 9)
print(newAlbum2)
newAlbum3 = make_album('Outsiders, Menog', 'Psychedelic Liquid')
print(newAlbum3)