Hello, Python!
Intro to Python · Lesson 1 of 4
What is Python, and why start here?
Python is a programming language used to build websites, analyze data, control robots, and much more — it's one of the most widely used languages in the world, and it reads almost like plain English. That makes it a great first language: you'll spend your time learning how to think like a programmer instead of fighting complicated syntax.
Running your first program
You don't need to install anything. If you haven't made a free Replit account yet, follow our Replit setup guide first — it walks through creating an account and your first Python Repl. Otherwise, open your Repl and you'll have a blank Python file with a "Run" button. Type the line below into it and hit Run:
print("Hello, world!")
You should see Hello, world! appear in the console. print() is a function — a reusable command — that displays whatever you put inside the parentheses.
Comments
Anything after a # is a comment: Python ignores it completely. Comments are notes for humans, not the computer.
# This line does nothing when run
print("This line does something")
Variables & assignment
A variable is a named box that stores a value. You create one with =:
name = "Ada"
age = 16
print(name)
print(age)
Variable names should describe what they hold, can't start with a number, and can't contain spaces (use _ instead, e.g. favorite_color).
The four basic types
Every value in Python has a type. The four you'll use constantly:
| Type | Meaning | Example |
|---|---|---|
int |
whole number | 17 |
float |
decimal number | 3.14 |
str |
text, in quotes | "hello" |
bool |
True or False | True |
You can check any value's type with type(): print(type(17)) prints <class 'int'>.
Simple arithmetic
Python supports the operators you'd expect: + - * /, plus ** for exponents and % for remainder ("modulo").
x = 10
y = 3
print(x + y) # 13
print(x - y) # 7
print(x * y) # 30
print(x / y) # 3.3333333333333335
print(x % y) # 1 (remainder of 10 / 3)
Try it yourself
In Replit, create two variables — base and height — set to any numbers, then print the area of a triangle using the formula 0.5 * base * height.
Assignment: Personal Intro
Write a program that creates four variables — your name, your age, your favorite subject, and a fun fact about you — then uses print() to introduce yourself using all four, e.g.:
Hi, I'm Priya! I'm 16 years old, my favorite subject is
Computer Science, and I once built a robot out of cardboard.
When you're done, copy your Replit link and submit it below.
