From 654349da4c4c9266c5405ee763713b4c4cf040f0 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Wed, 12 Feb 2025 10:48:04 -0500 Subject: [PATCH] Completed Exercise 8-7 Album --- Chapter_08/8-07_album.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Chapter_08/8-07_album.py diff --git a/Chapter_08/8-07_album.py b/Chapter_08/8-07_album.py new file mode 100644 index 0000000..ad2fff8 --- /dev/null +++ b/Chapter_08/8-07_album.py @@ -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) \ No newline at end of file