Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # lanzar excepciones
- def sumar(a,b):
- """Funcion que recibe dos numeros y devuelve su suma"""
- if not isinstance(a, (int, float)) or not isinstance(b, (int,float)):
- raise TypeError("Se requieren dos numeros")
- return a + b
- print(sumar(2,5.8))
- print(sumar([1,2], [True,"Chau"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement