Python Classroom notes 04/Jun/2026

Debugging code

  • Lets debug the following code
num = int(input("Enter a number: "))

if num > 1:
    for i in range(2, num):
        if num % i == 0:
            print(num, "is not a prime number")
            break
    else:
        print(num, "is a prime number")
else:
    print(num, "is not a prime number")
  • create a folder called as debugging and open visual studio code
mkdir debugging
cd debugging
code .
  • Ensure python extension from microsoft is installed.
  • create a file called main.py and copy the above code.
  • To run the code python main.py

Debugging Terms

  • Breakpoint
  • Step over (Execute the current line)
  • Variables
  • Call Stack
  • Debug console

  • Simple program

num = 81

if num % 2 == 0:
    print("Even number")
else:
    print("Odd number")

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading