Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Script que pide dos numeros y devuelve su cociente
- def ingresar_numero(tipo):
- while True:
- try:
- n = int(input(f"Ingrese el {tipo}: "))
- except ValueError:
- print("No ha ingresado un nĂºmero entero")
- else:
- if tipo == "divisor" and not n:
- print("El divisor debe ser no nulo")
- continue
- return n
- a = ingresar_numero("dividendo")
- b = ingresar_numero("divisor")
- print(f"El cociente entre {a} y {b} es {a/b}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement