-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday_12_specificexceptions.py
More file actions
38 lines (36 loc) · 1.22 KB
/
Copy pathday_12_specificexceptions.py
File metadata and controls
38 lines (36 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
try:
print(10/0)
except ZeroDivisionError:
print("You cannot divide by zero")
try:
age = int(input("Enter age: "))
except ValueError:
print("Please enter a number")
# Very Important (learn these first)
# ZeroDivisionError for division by zero
# ValueError for invalid input
# TypeError for type mismatch
# NameError fro variable not defined
# IndexError for index out of range
# KeyError for key not found
# AttributeError fro attribute not found
# Important
# ImportError for module not found
# ModuleNotFoundError for module not found
# FileNotFoundError for file not found
# PermissionError for permission denied
# RuntimeError for unexpected runtime error
# RecursionError for too much recursion
# Useful to know
# StopIteration for iterator exhausted
# EOFError for end of file
# AssertionError for assertion failed
# NotImplementedError for method not implemented
# UnicodeError for Unicode related error
# OverflowError for integer overflow
# Networking/System related (later)
# OSError for operating system error
# TimeoutError for operation timeout
# ConnectionError for network connection error
# BrokenPipeError for broken pipe
# ConnectionResetError for connection reset