Python for Data Engineers & Data Analysts – Day 1: Learn Python from Scratch

Telegram Group Join Now
WhatsApp Group Join Now

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:

  1. 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.
  2. 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.
  3. 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 like C:\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\ and C:\Python312\Scripts\).
      • Click OK to save, then reopen Command Prompt and try where python again.

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.

  1. Download Python:
    • Visit python.org and grab the latest version for macOS from the Downloads page.
  2. 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.
  3. 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, then Y, then Enter.
    • Run source ~/.zshrc to apply the changes.
  4. 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 typing python3.
  5. Verify Installation:
    • Type python --version in Terminal. You should see something like Python 3.12.0.
    • If not, double-check the PATH or try python3 --version.

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:

  1. Download VS Code:
  2. 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.
  3. 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:

  1. Make a Project Folder:
    • Create a folder on your desktop called python_30 (or whatever you like).
  2. Open It in VS Code:
    • In VS Code, go to File > Open Folder and select python_30.
  3. 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.
  4. 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!
  5. Set the Interpreter:
    • Press Ctrl + Shift + P (Windows) or Cmd + Shift + P (Mac).
    • Type Python: Select Interpreter and pick the one in my_venv (it’ll show the path like my_venv/bin/python).

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.”

  1. 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).
  2. 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!

Want to try something else? Let’s use a Jupyter notebook:

  1. Create a Notebook:
    • Press Ctrl + Shift + P and type Jupyter: Create New Blank Notebook.
    • Save it as getting_started.ipynb.
  2. Run Some Code:
    • In the first cell, type:
      print("Hello Python")
      
    • Hit Shift + Enter to run it. If it asks to install ipykernel, say yes.

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.

  • Basicsprint("Hello World") shows Hello 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 \nprint("Line 1\nLine 2")

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 or print.
  • Using Them: Just call the name: print(age) shows 25.

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?

  • Basicsname = 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:

  • Addition5 + 3 = 8
  • Subtraction5 - 3 = 2
  • Multiplication5 * 3 = 15
  • Division5 / 2 = 2.5 (always a float)
  • Floor Division5 // 2 = 2 (drops the decimal)
  • Modulus5 % 2 = 1 (remainder)
  • Exponentiation5 ** 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:

  1. F-Strings (my favorite):
    • f"Hi, {name}!"
    • Example:
      city = "Paris"
      temp = 18
      print(f"City: {city}, Temp: {temp}°C")
      
  2. .format() Method:
    • "Hi, {}".format(name)
    • Example:
      print("City: {}, Temp: {}".format(city, temp))
      
  3. % 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.

  • Basicslen("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:

  1. Fix the Print: This has an error—fix it:
    print('Hello, welcome to 30 days' python series')
    
  2. Greet the User: Ask for a name and age, then print a greeting like “Hi, Alex! You’re 25.”
  3. Math Time: Set two variables (e.g., a = 15b = 4) and print the results of addition, subtraction, multiplication, and division.
  4. 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:

The Best 5 AI Books to Build AI Apps Easily 2025

Top 13 FREE Data Analysis Courses with Certifications

Leave a comment