Manuals / Python / Chapter 3

A · Setup · beginner · Week 1–2 · Chapter 3 of 13

Syntax, types & control flow

Indentation, variables, strings, f-strings, if/for, lists, dicts. Enough to read test code and write helpers.

Path progress
18%

Step 1 of 3

Variables and f-strings

Dynamic typing — types exist at runtime. f-strings are the readable default for formatting.

Variables and f-stringsDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Variables and f-stdrag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Example

username = "standard_user"
password = "secret_sauce"
print(f"Attempting login for {username}")

Do this now

Script that stores username/password and prints formatted login attempt.

Was this step clear?
Chapter learning outcomes
  • Indentation rules
  • f-strings
  • if/elif/else
  • for loops
  • lists and dicts

Clear these before you leave

Side quest

Password validator

Function is_valid_password(s) → bool with length and empty checks.