Advertisement
FelipeNeto2

Divisão de números(Python)

Dec 9th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. def divide_two_numbers(x, y):
  2.   result = x / y
  3.   return result
  4.  
  5. try:
  6.   result = divide_two_numbers(2,0)
  7.   print(result)
  8. except NameError:
  9.   print("A NameError occurred.")
  10. except ValueError:
  11.   print("A ValueError occurred.")
  12. except ZeroDivisionError:
  13.   print("A ZeroDivisionError occurred.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement