Skip to content

Commit

Permalink
raise exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadelmalah committed Apr 20, 2024
1 parent ea356d8 commit a616f4c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Exceptions/raise_exception.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
x = -1

if x < 0:
raise Exception("Sorry, no numbers below zero")

# OR with a specific error type
# x = "hello"

# if not type(x) is int:
# raise TypeError("Only integers are allowed")

0 comments on commit a616f4c

Please sign in to comment.