-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0045_jukebox_menu.py
More file actions
29 lines (22 loc) · 861 Bytes
/
0045_jukebox_menu.py
File metadata and controls
29 lines (22 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
data = __import__('0044_nested_data_tuples')
albums = data.albums
# print(albums)
SONGS_LIST_INDEX = 3 # all constant variables are spelt in uppercase
SONG_TITLE_INDEX = 1
while True:
print("Please choose your album (invalid choice exists):")
for index, (title, artist, year, songs) in enumerate(albums):
print("{}: {}".format(index + 1, title))
choice = int(input())
if 1 <= choice <= len(albums):
songs_list = albums[choice - 1][SONGS_LIST_INDEX]
else:
break
print("Please choose your song:")
for index, (track_number, song) in enumerate(songs_list):
print("{}: {}".format(index + 1, song))
song_choice = int(input())
if 1 <= song_choice <= len(songs_list):
title = songs_list[song_choice - 1][SONG_TITLE_INDEX]
print("Playing {}".format(title))
print("="*40)