Meet Python
Meet Python, the interpreter, and the small pieces of a first program.
python, interpreter, program, syntax, outputGive the computer clear instructions
Imagine giving a friend a recipe. The recipe is not the meal: it is a set of instructions for making one. A program is a set of instructions for a computer. Python is a programming language for expressing such instructions.
Python is used for automation, websites, data analysis, and many other jobs. It is a tool, not a guarantee that every task is easy or that every program is correct. The interpreter reads and runs Python instructions.
Read a first instruction
print("Hello, world!")
│ └─ the text to show
└─ ask Python to display a value
print is a built-in function: a named action available in Python. Parentheses
hold the value given to it. Quotes mark text, called a string. Spelling,
punctuation and indentation are part of Python's syntax, its writing rules.
Python illustration
print("Hello, world!")
print("Learning takes practice.")
Prepared output — not live execution:
Hello, world!
Learning takes practice.
The instructions run in order. print normally puts the next output on a new
line. The quotes are part of the code, not part of the displayed text.
When something goes wrong
Leaving off a closing quote or parenthesis makes the instruction invalid: Python reports a syntax error instead of guessing. Read the message, inspect the indicated line and nearby punctuation, then try again. A program that runs can still produce an incorrect answer, so check its result too.
Continue with setting up Python and then names and values.
Reflect on the concept
Four fixed questions to reinforce the reasoning. Answers are not saved or scored.
