Content · Programming · Python

Python Basic Syntax: Statements, Expressions, and Indentation

Basic Python syntax is built from expressions, statements, indentation, names, and punctuation. Learning their roles makes code predictable. Learn the essential ideas and try a practical example.

2 views Published Oct 17, 2026 Updated Oct 18, 2026 Admin

Basic Python syntax is built from expressions, statements, indentation, names, and punctuation. Learning their roles makes code predictable.

Understanding the Concept


An expression produces a value such as 4 * 5. A statement performs an action such as assigning a result to a name. An if statement chooses a block based on a condition; a colon and indentation define that block. Python generally uses newlines to separate simple statements rather than requiring semicolons. Parentheses group expressions and can improve readability.

When and Why You Would Use This


Review a short complete example combining calculation and a conditional statement. Read the operators in their evaluation order before predicting the output.

Practical Example


order_amount = 30
tax_rate = 0.10
order_total = order_amount * (1 + tax_rate)
if order_total >= 30:
    print("Total:", order_total)

Understanding the Example


The expression calculates 33.0. Because 33.0 is at least 30, the indented print runs. The parentheses explicitly group the amount multiplied by one plus the tax rate.

Example Output


Total: 33.0

Try It Yourself


Change the amount to 20 and predict whether the print statement runs. Then test it.

Common Beginner Mistakes


  • Adding semicolons everywhere because of habits from another language.
  • Forgetting the colon or indentation after a multiline condition.
  • Confusing an expression with a complete statement.

Key Takeaways


  • Expressions produce values and statements direct execution.
  • Indentation defines blocks after constructs such as if.
  • Parentheses clarify calculation order.
Share this resourceSend this page to someone who may find it useful.