Advertisement
teslariu

Integrador Santiago

Jan 24th, 2023
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. alumnos = []
  5. while True :
  6.     print("""
  7.          Ingrese el numero de la operacion que desea ejecutar:
  8.          1 - Añadir un alumno a la lista
  9.          2 - Ver la lista de alumnos
  10.          3 - Salir
  11.        """)
  12.     opcion = input(" >>>")
  13.     if opcion == "1" :
  14.         nombre_alumnos = input("Ingrese el nombre del alumno: ")
  15.         cursos = int(input("Ingrese la cantidad de cursos: "))
  16.         if nombre_alumnos == "" :
  17.             print("Error: no ha ingresado un nombre valido")
  18.         else:
  19.             alumnos.append([nombre_alumnos, cursos])
  20.             print("Ha ingresado el nombre correctamente!")
  21.        
  22.     elif opcion == "2":
  23.          for alumno in alumnos:
  24.             nombre = alumno[0]
  25.             cursos = alumno[1]
  26.             print(nombre + "-" + str(cursos) + " cursos")
  27.            
  28.     elif opcion == "3":
  29.         print("Gracias por utilizar este Programa!")
  30.         break
  31.     else:
  32.         print("La opcion ingresada no es correcta, por favor intente con otra.")
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement