01 Basic Syntax

Basic python

01 Python Basic Syntax

What you’ll learn in this chapter #

  • Experience the two main ways to run Python (interactive REPL and scripts)
  • Understand how to work with the most common data types: numbers, variables, and strings
  • Write small programs that use print and input

Expect to spend about 60–90 minutes. If time is tight, complete “Step 1” in roughly 20 minutes and revisit the remaining steps later.

Look back at the journey so far #

ChapterSkills you already gainedNew skills you add here
00 IntroductionPrepared your environment and mapped your study planReady-to-run setup for writing code
01 Python Basic Syntax (this chapter)Handle values, display output, and accept user input

The fundamentals here directly support the next chapter on conditionals and loops.

Where this fits in the bigger picture #

graph LR
  A[Getting started<br>Environment setup] --> B[Basic syntax<br>Working with values (this chapter)]
  B --> C[Conditionals & Loops]
  C --> D[Data structures & Functions]
  D --> E[Using modules]
  E --> F[Building projects]
  classDef highlight fill:#2563eb,color:#fff,font-weight:700;
  class B highlight;

Study tips #

  • Copy the examples exactly once, then change a small part (for example, tweak the message)
  • Try functions like type() and len() in the REPL immediately and note down the results
  • For the practice tasks, follow this flow: 5 minutes on your own → check the hint → reveal the answer

Step-by-step roadmap #

  1. Run Python for the first time
  2. Numbers and operators
  3. Variables, assignment, and naming
  4. Strings and input/output
  5. Wrap-up and practice

After each step, type the code yourself; repetition is the fastest route to long-term retention.