The print() command tells the computer to display information on the screen. In Python, you use parentheses and quotation marks to show the text you want the computer to "say."
print("Hello, world!")
This command prints exactly what's inside the quotation marks.
š” Real-Life Connections
When you see text messages or alerts on your phone, those are created using similar print functions in programming languages!
ā Display Messages
Instagram and Snapchat: "New message" or "Friend request sent"
š Debug Code
Calculator app: "Error" when you divide by zero
š® Game Messages
"Level Complete!" or "Game Over" from game code
š± Interactive Programs
Make text-based stories or games more engaging
Without print(), you wouldn't know what your program is doing ā it's how your computer "talks back" to you.
š¬ Activity #2: Guided Practice (10 minutes)
šØāš« Teacher Live Demonstration
Follow along with your teacher using these examples:
print('Hello World!')
print('Welcome to Python')
š Can You Spot the Errors?
Discuss with a partner why these errors occur:
ā print(Hello World)
Missing quotation marks!
ā print("Hello World")
Correct syntax!
ā print("Hello World)
Missing closing quote!
ā Print("Hello")
Capital P - Python is case-sensitive!
š± Interactive App Demo
š± Phone Screen:
š Click a button to see how print() works in real apps!
š» Activities #3 & #4: Practice Time!
š„ Activity #3: Partnership Practice (7 minutes)
Pair up and create a short Python program introducing yourself!
Your program should print:
⢠Your first and last name
⢠Your favorite subject
⢠Your dream career
āļø Try It Here:
šŗ Output:
Click "Run Code" to see output...
š” Tips:
⢠Use quotation marks: "text" or 'text'
⢠Use parentheses: print()
⢠Be creative: print('She said, "Python is easy!"')
⢠Test your partner's code!
š Activity #4: Independent Practice (10 minutes)