Completed Exercise 8-7 Album
This commit is contained in:
parent
8f084b80ba
commit
6d5878c8ac
17
Chapter_08/8-07_album.py
Normal file
17
Chapter_08/8-07_album.py
Normal file
@ -0,0 +1,17 @@
|
||||
# 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)
|
||||
Loading…
x
Reference in New Issue
Block a user