Debugging is the process of detecting and removing of existing and potential errors in a software code that can cause it to behave unexpectedly or crash.
2. What is debugger? Why it is needed?
Debugger is a debugging tool. It is used to identify coding errors at various development stages.
3. Name any built in python debugger.
Pdb
4. Write the Pbd command to print the value of variables.
p
5. What is exception handler?
Exception handler is a section of code that gracefully responds to exceptions. We can add try and except statement to write exception.
6. Write a program to calculate area of rectangle using try and except so that your program handles non-numeric input gracefully by printing a message and exiting the program. The following shows two executions of the program:
Enter length: 12
Enter width: three
Error, please enter numeric input
Enter length: six
Error, please enter numeric input
try:
l = int(input('Enter length: '))
b = int(input('Enter width: '))
area = l * b
print('Area is ',area)
except:
print('Error, please enter numeric input')