You are going to build one program across this track. It is a money tracker that reports where your money went this month. This lesson writes its first lines: a title with your name, and the month under it.
The concept
Press RUN on the box below. Then look at the CONSOLE section under the code.
The first Run on this page downloads Python into your browser, so the console says it is loading. That can take a while on a slow connection. Every Run after that is fast.
When it finishes, the console shows Hello from Python. You wrote a program, and Python ran it. Now try three lines:
Three lines of output, in the same order as the three lines of code. Python starts at the top of the file and runs one line at a time until it reaches the bottom. Every program you write in this track follows that order. When something looks wrong, a good first question is "which line ran first?"
The word doing the work is print. It is a function: a named piece of behaviour that Python already knows. You use it by writing its name, then parentheses. Whatever you put inside the parentheses, print writes out as one line.
The text inside the quotes is called a string. The quotes tell Python "this is text to keep exactly as typed", not an instruction.
The syntax
print("Money Tracker")Read it left to right:
printis the function's name. It is all lowercase. Python treatsPrintandprintas two different names.(and)call the function. Using a function this way is a function call. Everything between the parentheses is handed to it."Money Tracker"is the string. It starts and ends with a quote.
Double quotes and single quotes both make a string. "Money Tracker" and 'Money Tracker' mean the same thing. The two ends must match.
That choice matters when your text contains an apostrophe. "Ada's Money Tracker" works, because the apostrophe sits inside double quotes. With single quotes, Python would think the string ended at the apostrophe.
print() with nothing inside writes an empty line. That is useful for spacing your output.
A minimal working example
print("Ada's Money Tracker")
print("November 2026")
print()
print("Nothing spent yet")Four lines of code, four lines of output. The third one is blank. Later lessons replace the fixed text with values your program works out for itself.
Common mistakes
You leave out the quotes, and Python complains about a name. Run this:
The console shows This line runs, then:
NameError: name 'Hello' is not definedWithout quotes, Python reads Hello as the name of something you stored earlier. You stored nothing under that name, so it stops. Look at the line number above the error: line 2. Lines before it already ran. Lines after it never did.
You leave out the quotes around two words, and the error changes. Run this:
This time nothing prints at all, not even the first line. The console shows this, with ^ marks under the words Python could not read:
SyntaxError: invalid syntax. Perhaps you forgot a comma?Two bare words side by side are not valid Python. The comma suggestion is Python's best guess, and here it is wrong. The real fix is quotes: print("Money Tracker"). Python checks the whole file before it runs anything, so a syntax error stops every line, including the ones above it.
This difference trips up almost everyone at first. A syntax error means the file is not valid Python, so nothing runs. Any other error happens while running, so the lines above it have already printed. When your output is completely empty, look for a syntax error first.
You forget the closing quote. Run this:
SyntaxError: unterminated string literal (detected at line 2)"Unterminated string literal" means a string started and never ended. Python points at the line where the quote opened. Add the missing " before the ) and it runs.
You type Print with a capital P. Python answers NameError: name 'Print' is not defined. Did you mean: 'print'? Python names are case sensitive. Read the end of the error: it often suggests the fix.
Try it yourself
This is the start of your money tracker. Each step changes one thing. Check the console after every Run.
- Run the starting code below. Confirm the console shows
Your Name's Money Tracker. - Replace
Your Namewith your own name. Keep the'sand the double quotes around the whole thing. Run it. Confirm the console shows your title. - Add a second line under it:
print("November 2026"), with this month and year if you prefer. Run it. Confirm two lines appear, title first. - Add
print()as a third line, thenprint("Nothing spent yet")as a fourth. Run it. Confirm you see your title, the month, a blank line, thenNothing spent yet. - Break it on purpose: delete the closing
"on your month line. Run it. Confirm the console shows aSyntaxErrorand that your title did not print either. - Fix it: put the
"back before the). Run it. Confirm all your lines return in order.
Your tracker has a title and a month. Every line is fixed text for now. The next lesson stores your title and the month under names of their own, so the program can reuse them.