0% found this document useful (0 votes)
8 views1 page

Python Division Error Handling Example

The document contains a Python script named practical17.py created by Chirayu Khalwa, a B.Tech. Computer Science and Engineering student. The script prompts the user to input two numbers, attempts to divide them, and handles exceptions for division errors. It includes try, except, else, and finally blocks to manage the flow of execution and print relevant messages.

Uploaded by

coloursvisionxx
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)
8 views1 page

Python Division Error Handling Example

The document contains a Python script named practical17.py created by Chirayu Khalwa, a B.Tech. Computer Science and Engineering student. The script prompts the user to input two numbers, attempts to divide them, and handles exceptions for division errors. It includes try, except, else, and finally blocks to manage the flow of execution and print relevant messages.

Uploaded by

coloursvisionxx
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

[Link] [Link]

[Link]

#ENROLLMENT NO.: 202203103510493


#NAME: Chirayu khalwa
#BRANCH: [Link]. Computer Science and Engineering

try:
a= int(input("Enter a number"))
b= int(input("Enter a second number"))
c= float(a/b)
print("{0}/{1} = {2}".format(a,b,c))
except:
print("{0} is not divied by {1}".format(a,b))
else:
print("{0} is divide by {1}".format(a,b))
finally:
print("The End")

1 of 1 22/04/23, 13:43

You might also like