-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathException_Handling.py
More file actions
71 lines (54 loc) · 1.02 KB
/
Exception_Handling.py
File metadata and controls
71 lines (54 loc) · 1.02 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#overflow error
a=200.76
b=1111111111111111111111111111.78
try:
print("the addition is ",a**b)
except(OverflowError):
print("overflow error ocured")
#divide by zero
a=4
b=0
try:
print("Division by zero ",a/b)
except(ZeroDivisionError):
print("divide by zero error ")
#value error
try:
b=int(input("Enter teh variable to raise the Value eroorr"))
except(ValueError):
print("Value Error")
#UnboundLocal Error
try:
def f():
a = a + 1
f()
except (UnboundLocalError):
print ("UnboundLocal Error")
#Type Error
a='2'
b=2
try:
print("a+b",a+b)
except(TypeError):
print("type error ")
# Name error
d=10
g=7
try:
print("Div",d+c)
except(NameError):
print("name error ")
#indrntation
def f():
pass
try:
f()
except(IndentationError):
print("error")
#syntax error
amount = 10000
try:
if(amount > 2999)
print("You are eligible to purchase gold")
except:
print("This is syntax error")