Hello, Python
The first program, print, and how to read an error message.
What is a program
A program is a list of instructions the computer carries out one after the other, from top to bottom. In Python these instructions read almost like plain English, which makes it a good first language.
You can write Python in any code editor. In class we use VS Code, but every exercise here also works in an online editor such as replit.com.
The first program
print("Hello, world")This line calls the function print, which shows whatever is inside the parentheses. The text is wrapped in quotes because it is a string: a sequence of characters, exactly as we typed them.
You can print several things at once, and Python puts a space between them:
print("Next year I will be", 21)When something goes wrong
Errors are a normal part of programming. What matters is reading them. Try running:
print("Hello)Python answers with something like:
SyntaxError: unterminated string literal (detected at line 1)The message tells you two things: what went wrong (a string that was never closed) and where (line 1). Almost every error message is built this way. Read it from the end: the last line is the important one.