Python program to demonstrate debugging of script
gd.py
import pdb def add(a): return a * a pdb.set_trace() a = input("A = ") b = input("B = ") c = int(a) + int(b) print(c) d = add(3) print(d)
Output
godarda@gd:~$ python3 gd.py
> /home/godarda/gd.py(6)<module>()
-> a = input("A = ")
(Pdb) n
A = 1
> /home/godarda/gd.py(6)<module>()
-> b = input("B = ")
(Pdb) n
B = 8
> /home/godarda/gd.py(6)<module>()
-> c = int(a) + int(b)
(Pdb) n
> /home/godarda/gd.py(6)<module>()
-> print(c)
(Pdb) c
9
9
Comments and Reactions
What Next?
Python program to print the current date and time
Python implementation of the calendar modulePython Control StatementsAdvertisement