Advertisement
teslariu

Untitled

Dec 2nd, 2020
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. Escribir un programa que le permita al usuario ingresar un conjunto de
  5. notas, preguntando a cada paso si desea seguir haciendolo. Cuando deje
  6. de ingresarlas, imprimir el promedio y terminar el programa
  7. """
  8. while True:
  9.  
  10.     notas = []
  11.     suma = 0
  12.     while True:
  13.         nota = int(input("Ingrese una nota: "))
  14.         notas.append(nota)
  15.         suma = suma + nota
  16.         opcion = input("Presione cualquier tecla si desea continuar ingresando notas ('W' para salir): ")
  17.         if opcion.casefold() == "w":
  18.             break
  19.     print(f"El promedio de las notas ingresadas es {suma/len(notas)}")
  20.     opcion = input("Presione cualquier tecla si desea continuar usando el programa ('X' para salir): ")
  21.     if opcion.casefold() == "x":
  22.         print("Gracias por usar este programa.....")
  23.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement