Python program to demonstrate debugging of script
kw.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
kodingwindow@kw:~$ python3 kw.py > /home/kodingwindow/kw.py(6)<module>() -> a = input("A = ") (Pdb) n A = 1 > /home/kodingwindow/kw.py(6)<module>() -> b = input("B = ") (Pdb) n B = 8 > /home/kodingwindow/kw.py(6)<module>() -> c = int(a) + int(b) (Pdb) n > /home/kodingwindow/kw.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