diff --git a/Chapter_08/8-08_user_albums.py b/Chapter_08/8-08_user_albums.py new file mode 100644 index 0000000..d033287 --- /dev/null +++ b/Chapter_08/8-08_user_albums.py @@ -0,0 +1,32 @@ +# Exercise 8-8 User Albums +# Learning Objective: Write a function with a while loop that gathers input and returns a dictionary of information about an album. + +# VERY MESSY + +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 + +while True: + print("Welcome, entering 'q' will quit this program... \n") + gathered_artist = input("Please enter your artist: ") + if gathered_artist == 'q': + break + gathered_album = input("Now enter the album name: ") + if gathered_album == 'q': + break + desired_info = make_album(gathered_artist, gathered_album) + print(desired_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