# if value of x is given as zero the zero divison error generates and program terminates
x=int(raw_input('Enter the number of students failed:'))
y=100/x
print y
# If x is not defined itself the program not terminated instead it goes to except loop
try:
x=int(raw_input('Enter the number of students failed:'))
y=100/x
print y
except ZeroDivisionError:
x=1
y=100/x
print y
No comments:
Post a Comment