Lazo Lab Sign up

Read Python Like a Pro / Reading code

Lesson 1 of 10

Why reading code matters

Programmers spend far more time reading code than writing it: their own old code, teammates' code and examples online. If you can read a program and predict what it does, writing your own gets much easier.

Key points

  • Read top to bottom, one line at a time
  • Ask: what is each variable holding right now?
  • Guess the output before you run it
name = "Lazo"
greeting = "Hi " + name
print(greeting)

Your turn

Copy the code into a file called read.py, guess the output, then run it with python3 read.py. Were you right?

Watch a video on thisOpens YouTube search results for “Why reading code matters” in a new tab

Quiz · +10 XP

What does the code above print?

Log in to save progress and earn XP.