0% found this document useful (0 votes)
2 views10 pages

Day 04 Python Exception Handling

Uploaded by

drravindra13
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views10 pages

Day 04 Python Exception Handling

Uploaded by

drravindra13
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CODEITUP

CS Class 12 | Chapter 05 | Exception Handling

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling
try:
a=int(input("Enter Numerator:")) try:
b=int(input("Enter Denominator:")) a=int(input("Enter Numerator:"))
b=int(input("Enter Denominator:"))
c=a/b c=a/b
print(c) print(c)
except ZeroDivisionError: except ZeroDivisionError:
print("Divide By Zero") print("Divide By Zero")
except ValueError: except ValueError:
print("Wrong Value Supplied") print("Wrong Value Supplied")
except:
print("Some Error Happened")

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling

try:
a=int(input("Enter Numerator:"))
b=int(input("Enter Denominator:"))
c=a/b
print(c)
except ZeroDivisionError:
print("Divide By Zero")
except ValueError:
print("Wrong Value Supplied")
except:
print("Some Error Happened")
else:
print("Program Executed Successfully...")
finally:
print("I will always be executed...")

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 05 | Exception Handling

age=int(input("Enter Your Age:"))


if age<18:
raise Exception("Age Less than 18")
else:
print("Eligible for Voting...")

Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore


[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses

You might also like