Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- cociente = int(input("Ingrese un divisor: "))
- try:
- a = 25 / cociente
- except ZeroDivisionError:
- print("no se puede dividir por cero")
- else:
- print(f"Cociente: {a}")
- finally:
- print("Adiós")
- # forma no recomendable 1
- cociente = int(input("Ingrese un divisor: "))
- try:
- a = 25 / cociente
- except:
- print("Error")
- else:
- print(f"Cociente: {a}")
- finally:
- print("Adiós")
- # forma no recomendable 2
- cociente = int(input("Ingrese un divisor: "))
- try:
- a = 25 / cociente
- except Exception:
- print("Error")
- else:
- print(f"Cociente: {a}")
- finally:
- print("Adiós")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement