ej4.7.py

#!/usr/bin/python # -*- coding: utf-8 -*- def calcula_calificacion(puntuacion): #Si la nota no esta comprendida entre 0 y 1 generamos un error if nota < 0.0 and nota > 1.0: raise ValueError if nota < 0.6: calificacion = 'Insuficiente' elif nota >= 0.6 and nota < 0.7: calificacion = 'Suficiente' elif nota >= 0.7 and nota < 0.8: calificacion = 'Bien' elif nota >= 0.8 and nota < 0.9: calificacion = 'Notable' elif nota >= 0.9: calificacon = 'Sobresaliente' return calificacion try: nota = float(raw_input('Introduzca puntuación: ')) print calcula_calificacion(nota) except: print "Puntuación incorrecta"

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.