-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathejercicio playlist.py
More file actions
42 lines (30 loc) · 1.05 KB
/
ejercicio playlist.py
File metadata and controls
42 lines (30 loc) · 1.05 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
playlist = {}
playlist['canciones'] = []
# Funcion principal
def app():
agregar_playlist = True
while agregar_playlist:
nombre_playlist = input('¿Como deseas llamar tu playlist?: ')
if nombre_playlist:
playlist['nombre'] = nombre_playlist
agregar_playlist = False
agregar_canciones()
def agregar_canciones():
agregar_cancion = True
while agregar_cancion:
nombre_playlist = playlist['nombre']
pregunta = f'\r\nAgrega canciones para la playlist {nombre_playlist}: \r\n'
pregunta += 'Escribe x para dejar de escribir canciones: \r\n'
cancion = input(pregunta)
if cancion == 'x':
agregar_cancion = False
mostrar_resumen()
else:
playlist['canciones'].append(cancion)
def mostrar_resumen():
nombre_playlist = playlist['nombre']
print(f'playlist: {nombre_playlist} \r\n')
print('canciones:\r\n')
for cancion in playlist['canciones']:
print(cancion)
app()