-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexp.py
More file actions
43 lines (35 loc) · 781 Bytes
/
Copy pathexp.py
File metadata and controls
43 lines (35 loc) · 781 Bytes
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
try :
n = 0
res = 100/n
except zeroDivisionError:
print("You Can't divide by zero!")
else:
print("Result is:", res)
finally:
print("Execution Complete")
try:
Value = int(input("Enter a Number:"))
# return Value
except ValueError:
print("Value Division Error")
else:
print("Value is:", Value)
finally:
print("Exception Complete")
try:
file1 = open("example.txt","r")
except FileNotFoundError:
print("File Not Found Error")
else:
print("File Opened Successfully!")
file1.close()
finally:
print("Execution Complete")
try:
n = int(input("Enter A Number:"))
except KeyboardInterrupt:
print("Input Canceled by the user")
else:
print("Number entered by user is:", n)
finally:
print("Execution Complete")