Skip to content

Commit

Permalink
Merge pull request mouredev#4343 from jptxaya/main
Browse files Browse the repository at this point in the history
mouredev#7 - Python
  • Loading branch information
kontroldev authored Jun 16, 2024
2 parents 848efda + e92b516 commit bddd663
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions Roadmap/07 - PILAS Y COLAS/python/jptxaya.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#PILAS Y COLAS

#PILAS
#Last Input First Output
my_list = [10,20,30,40]

my_list.append(50)
my_list.append(60)
#LIFO
my_list.pop()

print(my_list)

#COLAS
#First Input First Output
my_list = [10,20,30,40]

my_list.append(50)
my_list.append(60)

##FIFO
my_list.pop(0)

print(my_list)


print("DIFICULTAD EXTRA")
print("#######Navegacion########")
def navegador_web():
my_navigation = []
my_back_urls=[]

while True:
print("Selecciona la opcion:")
print("1-Navegar a url")
print("2-Adelante")
print("3-Atras")
print("4-Salir")
option = input("Selecciona la opcion:")
match option:
case "4":
break
case "1":
url_actual = input("Introduce la url:")
my_navigation.append(url_actual)
case "2":
if len(my_back_urls) > 0:
my_navigation.append(my_back_urls.pop())
case "3":
if len(my_navigation) > 0:
my_back_urls.append(my_navigation.pop())
if len(my_navigation) > 0:
print(f"URL actual: {my_navigation[len(my_navigation)-1]}")
else:
print(f"URL actual: None")

navegador_web()

print("#######Impresion########")
def impresion():
my_prints = []
while True:
print("Selecciona la opcion:")
print("1-Introducir documento")
print("2-Imprimir")
print("3-Salir")
option = input("Selecciona la opcion:")
match option:
case "3":
break
case "1":
doc = input("Introduce el documento:")
my_prints.append(doc)
case "2":
if len(my_prints) > 0:
print(f"Imprimiendo documento.... {my_prints.pop(0)}")
print("Documento impreso")
else:
print("No existen documentos para imprimir")

impresion()




0 comments on commit bddd663

Please sign in to comment.