"पाइथन प्रोग्रामिंग/कंडीशन": अवतरणों में अंतर

छोNo edit summary
No edit summary
पंक्ति 54:
except:
print("An error occurred dividing 1 by " + value + "!")
</source>
 
=== Except कथन ===
<source lang="Python">
try:
value = input("Enter a numeric value: ")
result = 1 / float(value)
print("1 / " + value + " = " + str(result))
except ValueError as error:
print(value + " is not a numeric value!")
except ZeroDivisionError as error:
print("Cannot divide by 0!")
except:
print("An unexpected error occurred dividing 1 by " + value + "!")
</source>