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

Code Debugging

The document presents a Python code snippet containing three syntax errors and provides the corrected version. Key issues include missing parentheses and incorrect variable names. The debugged code successfully executes conditional statements and prints the appropriate messages.

Uploaded by

amanda
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)
10 views1 page

Code Debugging

The document presents a Python code snippet containing three syntax errors and provides the corrected version. Key issues include missing parentheses and incorrect variable names. The debugged code successfully executes conditional statements and prints the appropriate messages.

Uploaded by

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