Loading...
Loading...
Write your first Python program
Every programming journey starts with one classic line: print("Hello, World!"). This tiny program does one thing ā it displays text on the screen. But behind that single line, you're learning two fundamental concepts that will appear in every Python program you ever write.
The print() function tells Python "hey, show this to the user." Think of it like a messenger ā you hand it a message, and it delivers it to the screen.
print("Hello, World!")| Part | What it's called | What it does |
|---|---|---|
| `print` | **Function name** | Tells Python you want to output something |
| `(` `)` | **Parentheses** | The "call" operator ā activates the function |
| `"Hello, World!"` | **String literal** | The message to display (text in quotes) |
When you run this program, Python does three things:
Try it in the editor below ā click Run Code and watch what happens!
print("Hello, World!")If you can't see what your program is doing, you're flying blind. print() is your window into the program's world. You'll use it for:
Without print(), your code runs invisibly. With it, you can see everything.
| ā Wrong | Why | ā Right |
|---|---|---|
| `Print("Hello")` | Python is case-sensitive ā `print` is lowercase | `print("Hello")` |
| `print(Hello)` | Missing quotes ā Python looks for a variable named `Hello` | `print("Hello")` |
| `print("Hello")` without parentheses | Parentheses are required to call a function | `print("Hello")` |
| `print('Hello')` | Single quotes work too, but be consistent | `print("Hello")` |
Write a program that prints your name and your favorite food, each on a separate line.
print("Infex")
print("Pizza")