Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # 3 estructuras: if, while, for
- """
- Script que pide el ingreso de notas. Se debe finalizar la carga
- con una nota igual a -1. Luego, se debera mostrar la cantidad de notas,
- el promedio, la nota mas alta y la nota mas baja
- """
- lista_de_notas = []
- while True:
- nota = int(input("Ingrese la nota: "))
- if nota < -1 or nota > 10:
- print("Error en el ingreso de la nota")
- continue
- if nota == -1:
- break
- else:
- lista_de_notas.append(nota)
- print(f"Total de notas: {len(lista_de_notas)}")
- print(f"Nota mas alta: {max(lista_de_notas)}")
- print(f"Nota mas baja: {min(lista_de_notas)}")
- print(f"Promedio: {sum(lista_de_notas)/len(lista_de_notas):.1f}")
Advertisement
Add Comment
Please, Sign In to add comment