Code Labs: Debugging
Hunt down Syntax and Logic Errors before deploying.
Interactive Engine
Test the debugging skills below. Code with Syntax errors will turn the terminal red.
User Input Required
The Crucible
Prove your knowledge of removing bugs.
The Syntax Crash
Syntax Errors happen when you break the grammatical rules of the programming language. The code will immediately crash and refuse to run.
Task: Find the two syntax errors in the code below and fix them so the programme successfully compiles and prints the message.
The Deceptive Math
Logic errors are sneaky. The computer perfectly understands the code, and it runs without crashing! But the outcome or calculation is wrong because the human told it to do the wrong thing.
Task: The code below calculates the area of a triangle. The area of a triangle should be (base * height) / 2. Fix the logic error so it outputs 25.0 instead of 100.0.
Complete Inspection
This function is supposed to check if a number is EVEN. It contains both a Syntax Error, and a Logic Error (Hint: even numbers divide by 2 with 0 remainder).
Task: Fix both errors so the terminal successfully completes its output proving that "10 is even" is True.