print() and your first program
Show text and numbers on screen, and add comments.
🎬 Video version coming soon — read it now
print() shows something on the screen. It's how your program talks to you.
Printing text and numbers
print("Welcome to IT Vizag")
print(2026)
print(10 + 5)Text goes inside quotes, single or double, it doesn't matter. Numbers don't need quotes. Python works out 10 + 5 first and then prints 15.
Printing several things at once
Separate them with commas. Python puts a space between them:
print("RK Beach is", 2, "km away")Output: RK Beach is 2 km away
Comments: notes for humans
Anything after a # is ignored by Python. Use comments to explain why you did something:
# Greeting shown when the program starts
print("Hello!") # this part is ignored tooYour first real program
# My introduction
print("Hi, I'm Ravi")
print("I live in Visakhapatnam")
print("I'm learning Python, lesson 3 of 10")Python runs the lines top to bottom, one at a time. Order matters.
Common first mistakes
- Missing quote:
print("Hello)gives a SyntaxError. - Capital P:
Print("Hi")gives a NameError. Python is case-sensitive. - Missing brackets:
print "Hi"was old Python 2 style and doesn't work now.
Tip: Change the program to introduce yourself, then add a line with your favourite food. Breaking and fixing small things is how you learn.
In one line
print() shows text and numbers, # starts a comment, and Python runs your lines from top to bottom.
Saved on this device. Sign in to keep progress everywhere.
Share with a friend