Knowledge organisersDesigning, creating and refining algorithms
Identify syntax/logic errors in code and suggest fixes
When writing or reading algorithms, you need to be able to identify two types of error: syntax errors and logic errors. Syntax errors break the rules of the programming language and stop the program from running. Logic errors allow the program to run but produce incorrect or unexpected results. Being able to spot and fix both is a key programming skill.
printt), missing brackets, missing quotation marks, incorrect indentation, using =< instead of <=.num1 + num1 instead of num1 + num2), incomplete conditions, wrong loop bounds, wrong operator.# SYNTAX ERROR - missing closing bracket
# print("Hello World"
# LOGIC ERROR - wrong formula
distance = 100
time = 20
speed = time / distance # Should be distance / time
print(speed) # Outputs 0.2 instead of 5.0