DEV Community

Nelly Triza
Nelly Triza

Posted on

Python Finally Started Making Sense When I Stopped Treating It Like Magic ๐Ÿ

Iโ€™ll be honest.

When I first started learning Python, I looked at code and thought:

โ€œOkay... but why does the computer understand this?โ€ ๐Ÿ˜‚

There were variables, strings, integers, floats, booleans, input(), type(), f-strings...

It felt like learning a new language where everyone had forgotten to give me the dictionary.But after practicing the basics, something started to click.

Python isn't magic.

It's mostly about "telling the computer exactly what kind of information you're giving it and what you want it to do with that information."

So here are some of the things that finally started making sense to me.


๐Ÿงฑ 1. Variables Are Basically Little Boxes

Imagine I have a box labelled name.

I can put "Amina Wanjiku" inside it.

name = "Amina Wanjiku"
Enter fullscreen mode Exit fullscreen mode

Another box called age:

age = 24
Enter fullscreen mode Exit fullscreen mode

And another called city:

city = "Nairobi"
Enter fullscreen mode Exit fullscreen mode

Now Python knows:

name โ†’ Amina Wanjiku
age  โ†’ 24
city โ†’ Nairobi
Enter fullscreen mode Exit fullscreen mode

I can simply ask Python to show me what's inside:

print(name)
print(age)
print(city)
Enter fullscreen mode Exit fullscreen mode

This was one of the first things that made programming feel less mysterious.

A variable is basically Python saying:

โ€œGive this information a name so we can use it later.โ€


๐Ÿ”ข 2. Not Every Number Is Actually a Number

This one caught my attention.

Look at these:

num_a = 7
num_b = "7"
Enter fullscreen mode Exit fullscreen mode

They look almost identical.

But Python sees two completely different things.

print(num_a + num_a)
Enter fullscreen mode Exit fullscreen mode

gives:

14
Enter fullscreen mode Exit fullscreen mode

While:

print(num_b + num_b)
Enter fullscreen mode Exit fullscreen mode

gives:

77
Enter fullscreen mode Exit fullscreen mode

Wait... what? ๐Ÿ˜‚

The reason is simple.

7 is an integer.

"7" is text.

So Python isn't adding 7 + 7.

It's joining:

"7" + "7"
Enter fullscreen mode Exit fullscreen mode

which becomes:

"77"
Enter fullscreen mode Exit fullscreen mode

That little difference taught me an important lesson:

Computers don't care what something looks like to us. They care what type of data it actually is.


๐Ÿ—ƒ๏ธ 3. Meet the Python Data Types

So far, I've met four of the basic ones:

str โ†’ Text

name = "Nelly"
Enter fullscreen mode Exit fullscreen mode

int โ†’ Whole numbers

age = 22
Enter fullscreen mode Exit fullscreen mode

float โ†’ Decimal numbers

balance = 74670.50
Enter fullscreen mode Exit fullscreen mode

bool โ†’ True or False

is_student = True
has_id_card = False
Enter fullscreen mode Exit fullscreen mode

And when I get confused about what something is, Python has my back:

print(type(age))
Enter fullscreen mode Exit fullscreen mode

Python responds:

<class 'int'>
Enter fullscreen mode Exit fullscreen mode

Basically, Python can tell me:

โ€œNelly, that's an integer. Please stop trying to treat it like text.โ€ ๐Ÿ˜‚


๐Ÿ—ฃ๏ธ 4. Then I Learned How to Make Python Ask Questions

This is where things became more interactive.

Before input(), my programs were basically me giving Python instructions.

Then I discovered:

name = input("What is your name? ")
Enter fullscreen mode Exit fullscreen mode

Now Python waits for the user to answer.

If I enter:

Nelly
Enter fullscreen mode Exit fullscreen mode

I can then do:

print("Hello", name)
Enter fullscreen mode Exit fullscreen mode

And Python responds:

Hello Nelly
Enter fullscreen mode Exit fullscreen mode

Suddenly, my program wasn't just sitting there displaying information.

It was having a conversation with me.


๐Ÿ’ฐ 5. My Accounting Brain Finally Got Involved

This is probably where I had the most fun.

I decided to create a simple money transfer calculation.

sender = input("Enter sender name: ")
recipient = input("Enter recipient name: ")
amount = int(input("Enter amount to send (Ksh): "))

charge = 11
total = amount + charge

print(f"Sending from {sender} to {recipient}")
print(f"Amount: Ksh {amount}")
print(f"Charge: Ksh {charge}")
print(f"Total: Ksh {total}")
Enter fullscreen mode Exit fullscreen mode

If I enter:

Sender: Nelly
Recipient: Amina
Amount: 1000
Enter fullscreen mode Exit fullscreen mode

Python can calculate:

Sending from Nelly to Amina
Amount: Ksh 1000
Charge: Ksh 11
Total: Ksh 1011
Enter fullscreen mode Exit fullscreen mode

And suddenly I'm thinking:

Wait... I can actually use this for finance. ๐Ÿ‘€

That connection between my accounting background and Python is one of the things making learning programming exciting for me.


โœจ 6. Then Came F-Strings

Before learning f-strings, I could write:

print("Name:", name, "Age:", age)
Enter fullscreen mode Exit fullscreen mode

It works.

But then I learned:

print(f"Name: {name}, Age: {age}")
Enter fullscreen mode Exit fullscreen mode

Much cleaner.

And Python can even calculate things inside the {}.

age = 22

print(f"Next year you will be {age + 1} years old")
Enter fullscreen mode Exit fullscreen mode

Output:

Next year you will be 23 years old
Enter fullscreen mode Exit fullscreen mode

So the {} isn't just for displaying a variable.

Python can actually do some work inside it.


๐ŸŽŸ๏ธ 7. From Tiny Concepts to an Actual Program

Then I combined everything I had learned and created a small ticket calculator.

The user enters:

Passenger name
Route
Fare
Booking fee
Enter fullscreen mode Exit fullscreen mode

Python calculates the total and prints a formatted ticket.

passenger_name = input("Enter passenger name: ")
route = input("Enter route: ")
fare = int(input("Enter fare (Ksh): "))
booking_fee = int(input("Enter booking fee (Ksh): "))

total = fare + booking_fee

print("=" * 40)
print("             TICKET")
print("=" * 40)

print(f"Passenger name: {passenger_name}")
print(f"Route:          {route}")
print(f"Fare:           Ksh {fare}")
print(f"Booking fee:    Ksh {booking_fee}")

print("-" * 40)

print(f"Total:          Ksh {total}")

print("=" * 40)
print("      THANK YOU FOR BOOKING!")
print("=" * 40)
Enter fullscreen mode Exit fullscreen mode

It's a tiny program.

But seeing those few lines turn into something interactive made the whole learning process feel different.


๐Ÿง  What I've Realised So Far

I'm learning that programming isn't about knowing everything.

It's about understanding a few concepts well enough to combine them.

Right now, my Python toolbox looks something like this:

๐Ÿ“ Strings       โ†’ Store text
๐Ÿ“ฆ Variables     โ†’ Store information
๐Ÿ”ข Integers      โ†’ Whole numbers
๐Ÿ’ฐ Floats        โ†’ Decimal numbers
โœ… Booleans      โ†’ True / False
โŒจ๏ธ Input         โ†’ Get information from users
๐Ÿ”„ Type casting  โ†’ Convert data types
๐Ÿงฎ Operators     โ†’ Perform calculations
โœจ F-strings      โ†’ Make output cleaner
Enter fullscreen mode Exit fullscreen mode

And these tiny building blocks can already create something useful.

That's probably my biggest takeaway so far:

You don't have to understand the whole programming world before you start building things.

Sometimes you just need to understand one little piece...

then another...

then another...

until suddenly the code that looked like random symbols starts telling a story.

And I'm just getting started. ๐Ÿ๐Ÿ’ป


What's next?

I'm moving on to conditionals, loops, lists, dictionaries and functions.

Eventually, I want to take these Python skills into data analytics and financeโ€”business analyst, where numbers aren't just sitting in spreadsheets waiting to be formatted. ๐Ÿ˜‰

For now, I'm learning in public, breaking things, fixing them and slowly figuring out what all these curly brackets and parentheses are trying to tell me.

One line of Python at a time.

Top comments (0)