Introduction
When I first started learning Python, I realised that programming was not as complicated as it sometimes looks. Like many beginners, I had heard about coding, programming languages and data analytics, but I did not fully understand how they all connected.
Python is a programming language that allows us to give instructions to a computer. It is popular because its syntax is relatively simple and readable as it uses simple English, making it a good starting point for people who are new to programming.
Python is also widely used in data analytics. It allows us to clean data, perform calculations, automate repetitive tasks and work with large datasets. It has useful libraries such as pandas, NumPy, Matplotlib and Seaborn, which support data analysis and visualisation.
One thing I found interesting is that tasks we might normally perform manually in Excel can sometimes be automated using Python. This makes it a useful skill for anyone interested in data analytics.
In this guide, I will walk through what I learned during my first week of learning Python, from understanding the tools to installing Python, setting up VS Code and running my first programs.
1. Understanding Python, VS Code, Google Colab and Jupyter Notebook
Before writing code, I first needed to understand the tools I would be using. At the beginning, it was easy to confuse Python with the applications used to write and run Python code.
Here is a simple explanation of the differences:
- Python: This is the programming language itself. It is also the interpreter that runs Python code on your computer.
- VS Code: This is a free code editor developed by Microsoft. It provides a place to write, organise and run Python files and build projects.
- Google Colab: This is an online platform that allows you to write and run Python code in a browser without installing Python on your computer. It is useful for learning and quick practice.
- Jupyter Notebook: This allows you to work with code in separate cells. You can combine code, results and written explanations in one file, making it useful when exploring and analysing data step by step.
A Jupyter Notebook file usually has the .ipynb extension. You can use notebooks in Google Colab or locally through Jupyter and VS Code.
The main thing I learned is that Python is the engine, while VS Code and Jupyter are places where you write and work with Python code. Installing VS Code alone does not install Python.
For this guide, I will use VS Code to create and run ordinary Python files ending in .py.
2. Installing Python on Windows
Since I was working on a Windows laptop, I installed Python through the Microsoft Store.
After installation, the next step was to confirm that Python was available on my computer.
To do this:
- Open the Command Prompt or PowerShell.
- Type the following command:
python --version - Press Enter.
If Python is installed correctly, the terminal displays the installed version.
3. Installing and Setting Up VS Code
After installing Python, I installed Visual Studio Code (VS Code). This is where I would write and organise my Python programs.
Once VS Code was installed, I needed to add the extensions that allow it to work with Python.
I followed these steps:
- Open VS Code.
- Click the Extensions icon on the left-hand side, or press
Ctrl + Shift + X. - Search for Python and install the extension published by Microsoft.
- Search for Jupyter and install the extension published by Microsoft.

 Let's me explain what is happening here:
The first line creates a variable called name and stores the text "Data Analyst" in it.
The second line uses print() to display a message. The f before the quotation marks creates an f-string, which allows us to insert a variable's value directly into a string using curly brackets.
To run the program in VS Code, I saved the file and clicked the Run Python File button at the top right. The output appeared in the terminal panel at the bottom of the screen.
There is also another way to run the same program. Open a terminal in your project folder say in Command Prompt or Powershell and type:
python hello.py Press Enter and Python will execute the file.
![]()
However, python hello.py runs the program in the terminal. It does not open the file in VS Code.
5. Understanding Variables and Data Types
As I continued learning, I discovered that variables are among the basic building blocks of Python.
A variable is a name that points to a value stored in memory. Let us imagine a labelled box: the label is the variable name, while the contents are the value stored inside it.
For example:
customer_name = "Wanjiku" age = 28 monthly_spend = 4500.50 is_active = True In this example, we have four variables storing different kinds of information.
Python has several basic data types:
- String (
str): Used for text, such as names and locations. - Integer (
int): Used for whole numbers, such as age or the number of customers. - Float (
float): Used for decimal numbers, such as prices or measurements. - Boolean (
bool): Represents eitherTrueorFalse.
You can use the type() function to check the data type of a value.
age = 28 print(type(age)) This tells Python to display the type of data stored in age.
Naming variables correctly
I also learned that variable names must follow certain rules.
For example, customer_name is a good variable name because it clearly describes the information being stored.
Python variable names:
- Can contain letters, numbers and underscores.
- Cannot begin with a number.
- Cannot contain spaces.
- Are case-sensitive, meaning
Salesandsalesare treated as different variables.
A useful naming convention is snake_case, where words are written in lowercase and separated by underscores.
6. Taking Input and Displaying Output
Another important concept I learned was how to allow a user to enter information into a program.
Python uses the input() function to collect information from a user and the print() function to display output.
For example:
name = input("What is your name? ") print(f"Hello, {name}!") When this program runs, it asks the user to enter their name. Whatever they type is stored in the name variable and Python displays a greeting.
However, input(): always returns the information as a string, even when the user enters a number.
For example, if we want to collect someone's age and use it in a calculation, we need to convert the input into an integer.
This is called type casting.
age = int(input("How old are you? ")) print(f"Next year you will be {age + 1}.") int() converts the entered value into a whole number so Python can perform the addition.
Other useful functions for conversion include:
-
float()converts a value into a decimal number. -
str()converts a value into text. -
bool()converts a value into a Boolean.
Understanding type conversion is important because Python cannot always combine different data types directly.
7. Working with Strings
Strings are just text values in Python. They are useful when working with names, emails, locations, descriptions and other text based information.
During my first week, I learned that Python provides several built-in string methods that help us work with and clean text.
For example:
city = " nAIrobi " clean_city = city.strip().title() print(clean_city) The output is:
Nairobi Here, strip() removes unnecessary spaces at the beginning and end of the text, while title() capitalises the first letter of each word.
Other useful string methods include:
-
lower()changes text to lowercase. -
upper()changes text to uppercase. -
replace()replaces one part of a string with another. -
find()searches for a particular character or word. -
count()counts how many times a character or sequence appears. -
split()separates a string into a list. -
len()tells us how many characters are in a string.
Python also allows us to access individual characters using indexing and select parts of a string using slicing.
For example:
county = "Mombasa" print(county[0]) print(county[-1]) print(county[0:3]) Python starts counting from zero, so county[0] gives the first character. Negative indexing allows us to count from the end, while slicing allows us to select a section of the text.
These skills are particularly useful in data analytics because real-world data is not always clean. Names, locations and other text values may contain inconsistent capitalisation or unnecessary spaces.
8. Introduction to Python Operators
Operators are symbols that tell Python to perform calculations, comparisons or logical operations.
I learned about several categories of operators:
Arithmetic operators perform mathematical calculations:
total = 1000 + 500 balance = 1000 - 200 product = 250 * 4 average = 100 / 4 Comparison operators compare values and return either True or False. Examples include:
== != > < >= <= For example, age >= 18 checks whether the value of age is greater than or equal to 18.
Logical operators combine conditions:
-
andmeans both conditions must be true. -
ormeans at least one condition must be true. -
notreturns a Boolean result that is either True or False.
9. Understanding PEP 8 and Good Coding Habits
As I learned to write Python code, I also came across the PEP 8 rules, which is Python's style guide.
PEP 8 provides recommendations that help programmers write code that is clean, readable and consistent.
Some of the habits I am learning to follow include:
- Use four spaces for each indentation level.
- Avoid mixing tabs and spaces.
- Use meaningful variable names that help other users easily understand.
- Leave spaces around operators, for example,
total = price * quantity. - Keep code organised and avoid unnecessarily long lines.
- Use comments when an explanation is needed.
These practices may seem small, but they make a difference when working on larger projects or collaborating with other developers.
10. Common Beginner Errors
When learning to code, errors are part of the process. I learned that an error message is not necessarily a sign that something has gone wrong permanently. It is often Python's way of showing us where to look.
Here are some common errors beginners may encounter:
| Error | What it means |
|---|---|
SyntaxError | Something is written incorrectly in the code, such as a missing colon or quotation mark. |
IndentationError | The spacing or indentation is incorrect. |
NameError | Python cannot find a variable because it may not have been defined or its name is incorrect. |
TypeError | An operation is being performed on incompatible data types. |
ValueError | A value cannot be converted or used as expected. |
One useful habit is to read the last line of an error message first. It often identifies the error type and gives us a clue about what needs fixing.
The important thing is not to panic when an error appears. Read it, understand what it is telling you and check the relevant part of your code.
Conclusion
My first week of learning Python introduced me to the basic concepts that make programming possible. I learned how to set up my environment, create and run Python files, work with variables and data types, collect user input, display output, clean strings and perform calculations.
I also learned that becoming comfortable with Python takes practice. It is not enough to read code and understand what it means; you need to write it, run it, make mistakes and try again.
For anyone starting out, my advice is to begin with the basics and take time to understand what each line of code does. You do not need to master everything at once.
Python has many applications in data analytics, and these beginner concepts provide a foundation for learning more advanced tools such as pandas, NumPy and data visualisation libraries.
This is only the beginning of my Python journey, and I look forward to building on these skills through more practical projects.
You can find the code examples and project files for this guide in my GitHub repository: View the Python 101 GitHub Repository







