Introduction
For a long time, Excel and Power BI have been my go-to tools for working with data. I was comfortable using formulas, cleaning datasets, performing calculations and creating reports. So, when I started learning Python for Data Analytics, I expected the transition to be straightforward.
Unlike Excel, where I could rely on formulas and menus to perform tasks, Python required me to write instructions and understand how those instructions were executed. Even simple tasks required me to think about the steps involved rather than just the final result.
During my first week, we covered quite a bit: setting up Python, variables, data types, input and output, strings, operators and conditional statements.In this article, I'm documenting what I learned during my first week, the mistakes I made and the examples that helped me connect Python to my existing data analytics knowledge.
You can find the code examples and screenshots in my GitHub repository.
Getting Started: Setting Up Python
Before writing my first program, I needed to understand the tools involved.One thing that initially confused me was the difference between Python, VS Code, Jupyter Notebook and Google Colab. They all seemed to serve a similar purpose, but I eventually understood that they are not the same thing.
Python is the programming language, while VS Code, Jupyter Notebook and Google Colab provide environments where I can write and run Python code.
I started with Google Colab because it was convenient. Since it runs in a browser, there was no need to install Python on my computer.
I opened a new notebook,renamed it, created a code cell and typed in it.
After pressing Shift + Enter, the output appeared underneath the cell.
It was a simple exercise, but seeing my first Python program execute successfully was a good starting point.
I later installed Python locally and set up Visual Studio Code (VS Code). One important detail I learned during installation was to select Add Python to PATH on Windows. This allows the computer's terminal to recognise Python commands.
To confirm that Python was installed correctly, I ran:
python --version
I also installed the Python and Jupyter extensions from Microsoft in VS Code.Once everything was ready, I created a dedicated folder for the course and opened it in VS Code using File → Open Folder. Inside the folder, I created a file named hello.py. The .py extension tells VS Code that the file contains Python code just like .sql in sql and .pbix in Power BI.
Understanding Virtual Environments and Jupyter Notebooks
Another concept I encountered was virtual environments.At first, I wondered why I needed one when Python was already installed on my computer.
I learned that a virtual environment creates an isolated space for a project and its Python libraries. This becomes useful when working on different projects that require different library versions.
I created my first virtual environment using:
After activating it, I installed some libraries that are commonly used in data analytics:
I also spent some time understanding Jupyter notebooks.
Unlike a regular Python file (.py), a notebook allows me to divide code into smaller cells and execute them independently. This is helpful when learning because I can run individual sections and immediately see the results.However, I discovered something important: notebook cells can be executed in any order. Python remembers variables from previously executed cells, which can sometimes lead to confusing results.
Restarting the kernel and running all cells from the beginning helps ensure that the notebook executes consistently.
Variables
Coming from an Excel background, I initially thought of variables as something similar to cells that hold values. While the idea is somewhat related, Python uses variables differently.
A variable is a name assigned to a value. It allows us to store information and reuse it throughout a program without having to enter the same value repeatedly.
For example:

In Python =means assign. age = 25 reads as "store 25 in age".
customer_name = "Mercy"
Data Types
Python automatically identifies the data type based on the value assigned. I could check this using the type() function:

One important lesson was that a value can look like a number but still be stored as text. This matters when performing calculations because Python treats numbers and strings differently.
Understanding data types is essential when cleaning data, performing calculations and working with datasets.
Updating Variables
Variables can also be updated as a program runs. For example, if I have 140 units in stock and sell 50, I can update the stock value:
Swapping Data and Multiple assigning
I also learned that Python allows multiple assignments and swapping values:
Naming Variables
Python has specific rules for naming variables.
Names can contain letters, numbers and underscores, but cannot start with a number or contain spaces. You also cannot use reserved keywords such as if or class as variable names. Another important detail is that Python is case-sensitive, meaning Sales and sales are treated as two different variables.
Input and Output in Python
Next, I learned how Python receives information and displays results. This is done using two basic functions: input()and print().
The input()function allows you to enter information, while print() displays the output.This is where I started understanding how Python interacts with users by collecting information, processing it and displaying results.
For example:
When the program runs, it displays the message Enter your name: and waits for the user to type a response.
One important thing I learned is that input() always returns a string even when the user enters a number.
To perform calculations, I need to convert the input into the appropriate data type using type casting.
Here, int() converts the quantity into a whole number, while float() converts the price into a decimal number.
Conclusion
My first week of Python was a mix of curiosity, small wins and a few frustrating moments. Some concepts came naturally, while others required me to go back, practise and try again.
Coming from Excel and Power BI, I'm beginning to see how Python fits into my data analytics journey. I still have a lot to learn, but I'm happy with the progress so far.
Next, I'll be exploring more concepts and gradually putting what I've learned into practice.
One week down, many more lines of code to write!








Top comments (0)