What You'll Learn
- •How to write and run your first Python program
- •Using the built-in print() function
- •Understanding basic string output
Python
# The classic first Python program
print("Hello, World!")Output
Hello, World!
Print "Hello, World!" in Python
This is the traditional first program you write in any language. It helps you verify that Python is installed and working correctly on your system.
print() function
print()is a built-in Python function used to display output on the screen.- Whatever you pass inside the parentheses is printed.
- Text (string) values must be written inside quotes (single or double).
How it works
- Python reads the line
print("Hello, World!"). - The string
"Hello, World!"is passed as an argument toprint(). - Python sends this text to the standard output (your terminal or console).
This single-line program introduces:
- Python's simple and clean syntax
- How to run a script
- How to display information to the user
Key Takeaways
1
print() is used to display output2
Strings must be enclosed in quotes
3
Python syntax is simple and readable
4
This is the foundation for all Python programs
Step-by-Step Breakdown
- 1Open a file named hello.py (or use a Python REPL).
- 2Write the line: print("Hello, World!")
- 3Run the file using: python hello.py
- 4Observe the output printed in the terminal.