Skip to content

Commit 852c780

Browse files
authored
Merge pull request mouredev#5261 from AbelPerezCollado/main
#7-Python
2 parents cc2d10e + c0ec916 commit 852c780

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Pilas
2+
pila = [1, 2, 3, 4, 5]
3+
4+
# Agregar elementos a una pila
5+
pila.append(6)
6+
pila.append(7)
7+
8+
print('Pila orignial: ', pila)
9+
10+
# Eliminar el ultimo elemento agregado a la pila
11+
pila.pop()
12+
print('Pila nueva: ', pila)
13+
14+
15+
# Colas
16+
cola = [2, 4, 6, 8, 10]
17+
18+
cola.append(12)
19+
cola.append(14)
20+
21+
print('Cola original: ', cola)
22+
23+
# Eliminar el primer elemento agregado a la cola
24+
cola.pop(0)
25+
26+
print('Cola nueva: ', cola)
27+
28+
# DIFICULTAD EXTRA
29+
30+
paginas = ['wwww.musica.com','wwww.musica.com/artistas','wwww.musica.com/canciones','wwww.musica.com/downloads']
31+
indice = 0
32+
print(f'La pagina web actual es: {paginas[indice]}')
33+
while True:
34+
35+
36+
opcion = input("Seleccione la opción deseada: ")
37+
38+
if opcion == '1' and indice < len(paginas) - 1:
39+
indice += 1
40+
41+
elif opcion == '2' and indice > -1 * len(paginas):
42+
indice -= 1
43+
44+
if opcion == '3':
45+
print('ADIOS!')
46+
break
47+
print(f'Indice: {indice}')
48+
print(paginas[indice])
49+
50+
#IMPRESORA
51+
52+
documentos = ['Documento1',]
53+
while True:
54+
print('MENU')
55+
print('1.- Imprimir')
56+
print('2.- Nuevo documento')
57+
print('3.- Salir')
58+
opcion = input('Seleccione la opcion deseada: ')
59+
if opcion == '1' and len(documentos) > 0:
60+
print(f'{documentos.pop(0)}...Imprimiendo')
61+
elif opcion == '2':
62+
documentos.append(input('Nombre documento: '))
63+
elif opcion == '3':
64+
print('Adios!')
65+
break
66+
else:
67+
print('Opción incorrecta')

0 commit comments

Comments
 (0)