0% found this document useful (0 votes)
2 views1 page

Python Code Debugging Guide

The document presents a Python code snippet containing multiple syntax errors and provides a corrected version. Key issues include missing parentheses, incorrect variable names, and misplaced statements. The debugged code ensures proper functionality of IF-ELSE structures and corrects the syntax for printing outputs.

Uploaded by

yusoofzehen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Python Code Debugging Guide

The document presents a Python code snippet containing multiple syntax errors and provides a corrected version. Key issues include missing parentheses, incorrect variable names, and misplaced statements. The debugged code ensures proper functionality of IF-ELSE structures and corrects the syntax for printing outputs.

Uploaded by

yusoofzehen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Code Debugging: Example Code in Python

Python code with 3 syntax errors: Debugged code:

print("This line of code is before both IF-ELSE functions"


countervariable = 125
if (countervarable < 100):
print("This line of code is before both IF-ELSE functions")countervariable =
print("Counter is smaller than 100") 125
print("This line is in the first if section") if countervariable < 100:
else
print("Counter is greater than 100")
print("Counter is smaller than 100")
print("This line is in the first else section") print("This line is in the first if section")
number = 3
if (number > 0):
print("Number is a positive number)
else:
print("This line is in the second if section") print("Counter is greater than100")
else: print("This line is in the first else section")
print("Number is a negative number")
print("This line is in the second else section")
number = 3
print("This line of code is after both of the IF-ELSE functions") if number > 0
print("Number is a positive number")
print("This line is in the second if section")

else:
print("Number is a negative number")
print("This line is in the second else section")
print("This line of code is after both of the IF-ELSE functions")

You might also like