🎯 Learning Goals for This Page
- Use the
print()function to display information to the user. - Understand what a "string" is in programming.
Displaying Information
The most fundamental thing a program does is communicate. The primary way we make our Python program talk is by using the print() function. Anything you put inside the parentheses will be displayed to the user in the console or shell.
Strings: The Language of Text
When we want to work with text, we call it a string. To create a string in Python, you must wrap your text in either single quotes (') or double quotes ("). Both work the same way, but you must be consistent.
Example Code:
print("Hello, World!")
print('This is our first real line of Python code.')
print("The year is 2025.")
Your Turn
Open Thonny or your online IDE. Create a new file called practice1.py. Write a few print() statements to introduce yourself or print a favorite quote. Run the code and see your program come to life!
Interactive Sandbox
Use this space to practice writing code and complete the "Your Turn" activities above.
Python 3Initializing...
Loading code editor...
Program output will appear here...