Statements and structure
A Python program is a list of statements that the computer executes one after another. The language has strict rules — called syntax — about how those statements must be written. Get the syntax slightly wrong and the program will refuse to run. The good news is the rules are small and consistent: once you have learned the basic shape of a statement you can read almost any Python program.
Comments
Comments are notes for humans that the computer ignores. Use them generously to explain why your code does something, not what it does. Future-you (and your teammates) will thank you.
print("Hello, World!")Case sensitivity and whitespace
Python is case sensitive — Total and total are two different names. Indentation makes code readable; in some languages it is purely cosmetic and in others (like Python) it is part of the syntax. Always indent the body of a block.
Python uses indentation (4 spaces) instead of curly braces. Indentation is part of the language, not just style.
Details for python
Assignment binds names to objects. Two names can share a mutable list; rebinding one is different from mutating the shared list. int supports large integers; / divides and // floors, including negative values.
Practice and verify
Change one meaningful value in the example and predict the result before running. Then test a boundary or empty value. Explain what changed and why, rather than only copying the output.