Debugging with Python - Part 3
Debugging with Python - Part 3 Debugging with Python - Part 3 Refer this article for Debugging with Python - Part 1. Refer this article for Debugging with Python - Part 2 (Debugging techniques - Part 1). Debugging techniques - Part 2 5. Exception Handling : Exception handling is the process used to prevent runtime errors occurring at the execution time, so that these errors wouldn’t cause our program to crash. In python, we can use try and except blocks to help us handle runtime errors and print out useful error messages. Let’s modify the simple calculator program we used in our type casting article to handle exceptions of user input and division by zero. while True : try : number1 = float ( input ( "Enter 1st number: " ) ) number2 = float ( input ( "Enter 2nd number: " ) ) result = round ( number1 / number2 , 2 ) except ValueError : print ( "Incorrect value, Enter a...