Hello, everyone! I’m so excited to welcome you to my 30-day Python series here on techcompreviews. Whether you’re an aspiring data analyst, a data engineer, or just someone curious about programming, this journey is for you. My goal is to take you from absolute beginner to Python pro in just one month. Over the next 30 days, I’ll be sharing daily lessons packed with practical tips, examples, and exercises to help you master Python step by step. Today marks Day 1, and I can’t wait to get started.
This series is designed with beginners in mind, so don’t worry if you’ve never written a line of code before. I’ll be guiding you through every detail, from setting up your tools to writing your first program. By the end of this post, you’ll have Python installed, a coding environment ready, and a solid grasp of some basic concepts. Plus, I’ll throw in a few exercises to get your hands dirty right away.
Here’s a quick sneak peek of what we’ll cover over the next 30 days:
- Week 1: Python basics—setup, variables, data types, and operations.
- Week 2: Functions, modules, and how to handle errors like a pro.
- Week 3: Data analysis with powerful libraries like NumPy and Pandas.
- Week 4: Automation tricks and a final project to tie it all together.
For today, our focus is on getting everything set up and dipping our toes into Python’s fundamentals. We’ll install Python on your computer (whether you’re on Windows or Mac), set up Visual Studio Code (VS Code), create a virtual environment, and write our very first line of code. Then, I’ll introduce you to essentials like print statements, variables, input functions, arithmetic operations, and string formatting. Ready? Let’s dive in.
Day 1: Getting Started with Python
Before we write any code, we need to set up our tools. Think of this as preparing your workspace—once it’s done, you’ll be ready to tackle anything. I’ll walk you through installing Python and VS Code on both Windows and Mac, step by step. Let’s start with Python.
Installing Python on Windows
If you’re using a Windows machine, here’s how I recommend setting up Python:
- Download Python:
- Head over to the official Python website at python.org.
- Go to the Downloads section, and you’ll see the latest version (like Python 3.12). Click the big yellow button to download the installer.
- Don’t worry about choosing the right file—it auto-detects your system.
- Install Python:
- Open the downloaded
.exe
file. - Super Important: At the bottom of the installer window, check the box that says “Add Python to PATH”. This lets you run Python from the command line without extra hassle.
- Click “Install Now” and let it run. It only takes a minute or two.
- If something goes wrong (like an error message), try restarting your computer and running the installer again.
- Open the downloaded
- Verify It Worked:
- Open the Command Prompt—type
cmd
into the Windows search bar and hit Enter. - Type
where python
and press Enter. You should see a path likeC:\Users\YourName\AppData\Local\Programs\Python\Python312\python.exe
. - If you don’t see anything, it might mean Python isn’t in your PATH. Let’s fix that manually:
- Right-click This PC on your desktop or File Explorer.
- Go to Properties > Advanced system settings > Environment Variables.
- Under System Variables, find Path, click Edit, and add the Python path (e.g.,
C:\Python312\
andC:\Python312\Scripts\
). - Click OK to save, then reopen Command Prompt and try
where python
again.
- Open the Command Prompt—type
Once you see that path, you’re good to go! Python is officially on your Windows machine.
Installing Python on Mac
For my Mac users, the process is just as straightforward, though it involves a couple of extra steps to link everything properly.
- Download Python:
- Visit python.org and grab the latest version for macOS from the Downloads page.
- Install Python:
- Open the downloaded
.pkg
file and follow the prompts. It’s pretty standard—just click through and agree to the terms. - Unlike Windows, the installer won’t automatically add Python to your PATH, so we’ll do that next.
- Open the downloaded
- Add Python to PATH:
- Open Terminal (find it in Applications > Utilities or use Spotlight search).
- Type
which python3
to see where Python installed (e.g.,/Library/Frameworks/Python.framework/Versions/3.12/bin/python3
). - Now, we’ll edit your shell configuration. I use Zsh (the default since macOS Catalina), so type
nano ~/.zshrc
to open the file. - Add this line at the bottom:
export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"
- Save it by pressing
Ctrl + X
, thenY
, then Enter. - Run
source ~/.zshrc
to apply the changes.
- Link Python:
- In Terminal, type:
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.12/bin/python3 /usr/local/bin/python
- Enter your admin password when asked. This creates a shortcut so
python
works instead of typingpython3
.
- In Terminal, type:
- Verify Installation:
- Type
python --version
in Terminal. You should see something likePython 3.12.0
. - If not, double-check the PATH or try
python3 --version
.
- Type
That’s it! Python is now ready on your Mac.
Setting Up Visual Studio Code (VS Code)
Next, we need a place to write our code. I love Visual Studio Code because it’s lightweight, customizable, and perfect for Python. Here’s how to set it up:
- Download VS Code:
- Go to code.visualstudio.com and download the version for your OS (Windows or Mac).
- Install VS Code:
- On Windows, run the
.exe
file and follow the prompts. You can also grab it from the Microsoft Store. - On Mac, open the
.dmg
file, drag VS Code to your Applications folder, and launch it.
- On Windows, run the
- Install Key Extensions:
- Open VS Code and click the Extensions icon in the sidebar (it looks like a square with four smaller squares).
- Search for and install these:
- Python: Adds Python support, including linting and debugging.
- Jupyter: Lets you work with Jupyter notebooks right in VS Code.
- Material Icon Theme: Optional, but it makes your files look prettier with icons.
With VS Code ready, we’re almost set to code!
Creating a Virtual Environment
Before we start coding, I want to show you how to create a virtual environment. This is like a sandbox for your projects—it keeps your Python packages separate so they don’t clash. Here’s how I do it:
- Make a Project Folder:
- Create a folder on your desktop called
python_30
(or whatever you like).
- Create a folder on your desktop called
- Open It in VS Code:
- In VS Code, go to File > Open Folder and select
python_30
.
- In VS Code, go to File > Open Folder and select
- Create the Virtual Environment:
- Open a terminal in VS Code (Terminal > New Terminal).
- Type:
python -m venv my_venv
- This creates a folder called
my_venv
with a fresh Python setup.
- Activate It:
- On Windows:
my_venv\Scripts\activate
- On Mac:
source my_venv/bin/activate
- You’ll see
(my_venv)
in your terminal—proof it’s active!
- On Windows:
- Set the Interpreter:
- Press
Ctrl + Shift + P
(Windows) orCmd + Shift + P
(Mac). - Type
Python: Select Interpreter
and pick the one inmy_venv
(it’ll show the path likemy_venv/bin/python
).
- Press
Now, anything we install stays in this virtual environment—nice and tidy!
Writing Your First Python Code
Time for the fun part—writing our first line of code! Let’s go with the classic “Hello World.”
- Create a Python File:
- In VS Code, right-click in the Explorer pane and choose New File.
- Name it
hello.py
(the.py
tells VS Code it’s Python).
- Write and Run “Hello World”:
- Type this:
print("Hello World")
- Right-click in the file and select Run Python File in Terminal.
- Look at the terminal—you’ll see
Hello World
! We did it!
- Type this:
Want to try something else? Let’s use a Jupyter notebook:
- Create a Notebook:
- Press
Ctrl + Shift + P
and typeJupyter: Create New Blank Notebook
. - Save it as
getting_started.ipynb
.
- Press
- Run Some Code:
- In the first cell, type:
print("Hello Python")
- Hit
Shift + Enter
to run it. If it asks to installipykernel
, say yes.
- In the first cell, type:
Seeing that output feels amazing, right? We’re officially coding in Python!
Basic Python Concepts
With our setup complete, let’s explore some foundational Python concepts. These are the building blocks we’ll use every day.
Print Statements
The print()
function is how we display stuff in Python. It’s super simple but powerful.
- Basics:
print("Hello World")
showsHello World
in the terminal. - Quotes: You can use single (
'
), double ("
), or triple quotes ('''
or"""
):print('Hi')
print("Hi")
print('''Hi''')
(great for multi-line text)
- Special Characters:
- Escape quotes with a backslash:
print("She said, \"Hi!\"")
- Add new lines with
\n
:print("Line 1\nLine 2")
- Escape quotes with a backslash:
Try This:
print("My To-Do List:\n- Learn Python\n- Eat lunch\n- Celebrate")
Output:
My To-Do List:
- Learn Python
- Eat lunch
- Celebrate
Variables
Variables are like labeled boxes where we store data. They’re essential for coding.
- How to Make Them: Use
=
to assign a value:age = 25
name = "Alex"
- Naming Rules:
- Start with a letter or underscore (e.g.,
score
,_total
). - No numbers at the start (e.g.,
1score
is a no-go). - Use letters, numbers, and underscores (e.g.,
score_1
). - Don’t use Python keywords like
if
orprint
.
- Start with a letter or underscore (e.g.,
- Using Them: Just call the name:
print(age)
shows25
.
Example:
city = "Tokyo"
temp = 20
print(city) # Tokyo
print(temp) # 20
Input Functions
The input()
function lets us talk to the user—pretty cool, right?
- Basics:
name = input("What’s your name? ")
prompts the user and saves their answer. - Default Type: Input comes as a string, even if it’s a number.
- Type Casting: Convert it if needed:
age = int(input("Your age? "))
.
Try This:
name = input("Enter your name: ")
age = int(input("Enter your age: "))
print(f"Hi, {name}! You’re {age} years old.")
If someone enters “twenty” instead of 20
, it’ll crash. We’ll fix that later with error handling, but for now, stick to numbers.
Arithmetic Operations
Python can do math like a champ. Here’s what we’ve got:
- Addition:
5 + 3
=8
- Subtraction:
5 - 3
=2
- Multiplication:
5 * 3
=15
- Division:
5 / 2
=2.5
(always a float) - Floor Division:
5 // 2
=2
(drops the decimal) - Modulus:
5 % 2
=1
(remainder) - Exponentiation:
5 ** 2
=25
(5 squared)
Example:
x = 10
y = 4
print(x + y) # 14
print(x - y) # 6
print(x * y) # 40
print(x / y) # 2.5
print(x // y) # 2
print(x % y) # 2
print(x ** 2) # 100
String Formatting
We can jazz up our strings by mixing in variables. Here are three ways:
- F-Strings (my favorite):
f"Hi, {name}!"
- Example:
city = "Paris" temp = 18 print(f"City: {city}, Temp: {temp}°C")
- .format() Method:
"Hi, {}".format(name)
- Example:
print("City: {}, Temp: {}".format(city, temp))
- % Operator (old school):
"Hi, %s" % name
- Example:
print("City: %s, Temp: %d" % (city, temp))
All three give the same result: City: Paris, Temp: 18
. F-strings are the easiest, so I’ll use those most often.
String Length with len()
The len()
function counts characters in a string—spaces included.
- Basics:
len("Python")
=6
- With Variables:
word = "Hello World" print(len(word)) # 11 (counts the space)
Try This:
email = input("Your email: ")
print(f"Your email is {len(email)} characters long.")
Exercises for Day 1
Let’s practice what we’ve learned! Here are a few challenges:
- Fix the Print: This has an error—fix it:
print('Hello, welcome to 30 days' python series')
- Greet the User: Ask for a name and age, then print a greeting like “Hi, Alex! You’re 25.”
- Math Time: Set two variables (e.g.,
a = 15
,b = 4
) and print the results of addition, subtraction, multiplication, and division. - Email Length: Ask for an email address and print how many characters it has.
Work on these in your hello.py
file or notebook. If you’re stuck, don’t worry—I’ll share solutions tomorrow.
Conclusion
Wow, what a day. We’ve covered so much on Day 1:
- Installed Python on Windows and Mac, making sure it’s ready to roll.
- Set up VS Code with the right extensions for a smooth coding experience.
- Created a virtual environment to keep our projects organized.
- Wrote our first “Hello World” in both a
.py
file and a Jupyter notebook. - Learned the basics: print statements, variables, input, math, and string formatting.
I’m proud of you for sticking with me through all this setup and coding. It might feel like a lot, but trust me, this foundation is key. Every step you took today brings you closer to mastering Python.
Tomorrow, we’ll dig deeper into variables and explore data types like integers, floats, and strings. Plus, I’ll show you how to combine what we’ve learned into mini-programs. For now, play with the exercises, experiment in VS Code, and let me know how it goes in the comments.
Happy coding, friends.
Read Also: