chapter 1.1

Hello, Python

Your first lines of code

Python is one of the most popular programming languages in the world — and for good reason. It reads almost like English, it's forgiving when you make mistakes, and it powers everything from web apps to machine learning.
Let's start with the most fundamental thing any program can do: print something to the screen.
print("Hello, world!")
print() is a function — it takes whatever you put inside the parentheses and displays it. The text inside the quotes is called a string. You can use either single quotes '...' or double quotes "..." — Python doesn't care.
print('Same thing, different quotes')
tip
Comments start with #. Python ignores everything after it on that line. Use comments to leave notes for yourself (or future you).
# This is a comment — Python skips this
print("But this runs!")
You can print multiple things by separating them with commas. Python adds a space between them automatically:
print("Hello", "from", "Python")
your turn
challenge

Modify the code to print three things: 1. A greeting 2. Your name 3. Your favorite number (use a comma to mix text and numbers)

loading editor...

output
$ Press RUN to execute your code
AI Tutor

Ask about Hello, Python

Hey! I'm your AI tutor.

Ask me anything about this lesson, or paste code you're stuck on.

AI tutor is a premium feature