📐 Syntax & Comments
Syntax & Comments: Picture a recipe book where steps are shown with indentation — a main step, a sub-step beneath it, a sub-sub-step beneath that.
Picture a recipe book where steps are shown with indentation — a main step, a sub-step beneath it, a sub-sub-step beneath that. Your eye instantly sees what's nested inside what. Java's curly braces do the same job by COUNTING brackets; your eye doesn't do that automatically, the compiler does. Python's designers asked: "We already use indentation for readability — why also count braces?" Their answer: we don't need to — indentation itself marks the block boundary. The cost? If a teammate mixes tabs and spaces, you get an invisible bug — which is exactly why "convert tabs to spaces" is a standard day-one editor setting on QA automation teams.
In Java, blocks open/close with {} and every statement ends with ";". Python has neither. Blocks start with ":" and continue by indentation.
Micro Lab: Python coding practice
Replace the TODO line with the critical line from the expected solution. This is not a real runtime; the goal is to reinforce writing the correct structure in a controlled way.
Step by Step: Python coding practice
Read inputs and data types
Complete the critical line with the smallest change
Run the code and compare expected output
If it fails, read traceback or assertion message
Make the result reusable for a test report
What is the safe order for running Python QA code?
Java vs Python — Syntax
How does Python mark the end of a code block?
Which of the following is true about indentation in Python?