Knowledge organisersTesting
Find and fix logic errors.
Debugging is the process of finding and fixing errors. Syntax errors are caught by Python, but logic errors produce wrong results and must be found by testing and tracing.
print() statements to check variable valuesdef average(a, b):
total = a + b
print("DEBUG: total=" + str(total)) # temporary
avg = total / 2
return avg
print(average(10, 20)) # DEBUG: total=30 → 15.0