18 min read
Your First Program
print() for output, text in quotes, comments with #, and the order in which lines run.
print() Shows Output
first.pyPython
print("Perera Corner Mart")print("Fresh bread every morning")print(250 + 480)Expected output
Perera Corner Mart Fresh bread every morning 730
- print() is a function: it shows whatever is inside the brackets.
- Text must be inside quotes — "double" or 'single'. Text in quotes is called a string.
- Numbers are not in quotes.
print(250 + 480)calculates first, then prints 730. - Each print() starts a new line.
Printing Several Items
Commas separate itemsPython
print("Rice:", 280, "rupees")print("Total", 280 + 450, sep=" = ")Expected output
Rice: 280 rupees Total = 730
Commas separate items; print() puts a space between them. The optional sep= changes the separator, and end= changes what is printed at the end instead of a new line.
Lines Run in Order
first.py as a flowchart — a simple sequence
Read this flowchart as text
- Terminator: Start (then → OUTPUT "Perera Corner Mart")
- Input/output: OUTPUT "Perera Corner Mart" (then → OUTPUT "Fresh bread every morning")
- Input/output: OUTPUT "Fresh bread every morning" (then → OUTPUT 250 + 480)
- Input/output: OUTPUT 250 + 480 (then → Stop)
- Terminator: Stop
Check your predictionsPython
print("5 + 3")print(5 + 3)print("Tea", "Coffee", sep=" | ")Expected output
5 + 3 8 Tea | Coffee
Practice
Which line is a comment?
More lessons in Python Programming · Next: Variables and Identifiers · Previous: Setting Up Python

Comments
Comments start with #Python
Expected output
A comment starts with #. Python ignores everything after # on that line. Use comments to say what a program does and why, especially at the top of a file and before tricky parts.