Skip to content

Commit

Permalink
Ejemplos vistos en clase con DAM
Browse files Browse the repository at this point in the history
  • Loading branch information
dcsibon committed Nov 14, 2024
1 parent fd4ddbd commit 99fba3a
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions pruebas/estructuras_datos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

import os


def limpiar_pantalla():
"""
Limpia la consola según el sistema operativo.
"""
os.system('clear' if os.name == 'posix' else 'cls')


def pausa():
"""
Pausa la ejecución del programa hasta que se pulse ENTER.
"""
input("\nPresione ENTER para continuar...")
limpiar_pantalla()


def main():
asignaturas = ["Mates", "Lengua", "Inglés", "Física", "Química", "Historia"]

limpiar_pantalla()

print(asignaturas)

pausa()

for asignatura in asignaturas:
print(asignatura)

pausa()

for i in range(len(asignaturas)):
if i < len(asignaturas) - 1:
print(asignaturas[i], end = " - ")
else:
print(asignaturas[i] + ".")

pausa()

pos = 0
frase = ""
while pos < len(asignaturas):
frase += asignaturas[pos] + ", "
pos += 1
print(frase[:-2] + '.')

pausa()


if __name__ == "__main__":
main()

0 comments on commit 99fba3a

Please sign in to comment.