Python in 3 Minutes 🐍
Python in 3 Minutes 🐍
Python is a general-purpose programming language known for clean syntax and readability. If you can write a grocery list, you're halfway to writing Python.
📌 Key Term
InterpreterA program that reads and executes Python code line by line.
Your First Program
print("Hello, World!")
What it does:
-
print()sends text to the screen. -
The text inside quotes is called a
string.
Output:
Hello, World!
Variables
A
variable
stores information.
name = "Aaron"
age = 42
print(name)
print(age)
Think of a variable as a labeled box you can put data into.
📌 Key Term
VariableA named location that stores a value for later use.
Basic Math
Python can act like a calculator.
a = 10
b = 5
print(a + b)
print(a * b)
print(a / b)
Output:
15
50
2.0
Making Decisions
Use an
if
statement to make choices.
temperature = 85
if temperature > 80:
print("It's hot outside.")
Python uses indentation instead of braces
{}.
Loops
A
loop
repeats work.
for number in range(5):
print(number)
Output:
0
1
2
3
4
Putting It Together
name = "Aaron"
for i in range(3):
print("Hello,", name)
Output:
Hello, Aaron
Hello, Aaron
Hello, Aaron
A Few Useful Technical Terms
| Term | Meaning |
|---|---|
string
|
Text data |
integer
|
Whole number |
function
|
Reusable block of code |
loop
|
Repeats code |
variable
|
Stores data |
if statement
|
Makes decisions |
That's enough Python to start reading simple programs and writing tiny utilities. 🚀
