Hey there! 👋 Ready to dive into Python? Let’s get you started with the basics. We’ll cover:
What Python is
Setting up your environment
Your first Python script
Variables & data types
Basic operations
Next steps & practice
1. What is Python?
High-level, easy-to-read programming language
Widely used for web dev, data science, automation, and more
Huge ecosystem & community → tons of libraries
2. Setting Up Your Environment
Install Python
Choose an Editor
Beginner-friendly: VS Code, Thonny, or even IDLE (bundled with Python)
For notebooks & data science: JupyterLab / Jupyter Notebook
To verify your install, open a terminal/command prompt and run:
bash Copy code
python --version
# or sometimes
python3 --version
3. Your First Python Script (“Hello, World!”)
Create a file named hello.py with:
python Copy code
print("Hello, world!")
Then run in terminal:
bash Copy code
python hello.py
You should see:
code Copy code
Hello, world!
Congrats—you just ran your first Python program! 🎉
4. Variables & Data Types
Variables
No need to declare types explicitly
Assign with =
python Copy code
name = "Alice"
age = 30
Common Data Types
int (integers): 42, -7
float (decimals): 3.14, -0.001
str (strings): "hello", 'Python'
bool (True/False): True, False
list: ordered mutable collection: [1, 2, 3]
dict: key/value pairs: {"name": "Bob", "age": 25}
Check types with type():
python Copy code
print(type(name)) # <class 'str'>
print(type(age)) # <class 'int'>
5. Basic Operations
Arithmetic
python Copy code
a = 10
b = 3
print(a + b) # 13
print(a - b) # 7
print(a * b) # 30
print(a / b) # 3.333...
print(a // b) # 3 (floor division)
print(a % b) # 1 (remainder)
print(a ** b) # 1000 (power)
String Concatenation
python Copy code
greeting = "Hello, " + name + "!"
print(greeting) # Hello, Alice!
Input from User
python Copy code
fav_color = input("What's your favorite color? ")
print("Nice! I like", fav_color, "too.")
6. Next Steps & Practice
Control Flow : if statements, loops (for, while)
Functions : reusable blocks of code with def
Data Structures : dive deeper into lists, tuples, sets, dicts
Projects :
Build a simple calculator
Parse a text file
Web scrape with requests + BeautifulSoup
Quick Exercise
Write a script that:
Asks the user for two numbers
Prints their sum, difference, product, and quotient
That’s a solid start! 🚀
What part would you like to explore next? Loops, functions, or maybe setting up a real project? Let me know!