Lesson 1: Python - Let's Start the Fun!


lesson1

Lesson 1: Python - Let’s Start the Fun!

Welcome, Fellow Python Enthusiast! 🐍

Alright, you’ve decided to embark on the grand adventure of learning Python! Don’t worry, this isn’t some snooze-fest like high school math (sorry, math lovers). Python is like that cool, laid-back teacher who lets you eat snacks in class while you learn. So grab your coffee, tea, or whatever fuels your brain, and let’s dive in.

What’s Python, Anyway?

Python is THE programming language everyone is talking about—if programming languages were movie stars, Python would be Brad Pitt. It’s used by everyone from beginners to professionals, and for good reason: it’s simple, powerful, and a lot of fun!

But don’t be fooled by its simplicity—Python is used for everything from web development to data science, AI, and even making video games. Whether you’re here to build the next Facebook, automate your life, or just impress your geeky friends, Python’s got your back.

Step 1: Python Is Already On Your Linux System!

The good news is, if you’re using Linux (which, if you’re in my course, you probably are), Python is already sitting on your computer, waiting to be your new best friend.

To check if Python is ready to roll, pop open your terminal and type:

python3

You should see something like this:

Python 3.x.x (default, ...)
Type "help", "copyright", "credits" or "license" for more information.
>>>

PS: If you see something like Python 2.x.x, don’t panic! It just means your system is using an older version of Python, but we’ll stick with Python 3 because, well, it’s the future! If you see this, congratulations—you’re about to become a coding wizard. If not, no worries, you can install it by typing:

sudo apt-get install python3

Or if you’re rocking Arch Linux (as all the cool kids do):

sudo pacman -S python

Now, Python is locked and loaded!

Step 2: Let’s Write Your First Python Program!

You can write Python in a fancy text editor, but we’re keeping it real simple for now. Type the following in your terminal (because we’re all about getting stuff done):

print("Hello, Python world!")

When you hit Enter, you should see:

Hello, Python world!

Congratulations, you’ve just written your first line of Python! 🎉 See? You didn’t need to be a genius or a wizard to start coding—just a few keystrokes and boom, you’re a programmer.

Step 3: Python Variables - Like Boxes for Your Stuff

Let’s get a little fancier now. Variables in Python are like magical containers that can hold things for you—numbers, text, even whole lists of things! And the best part? You don’t even have to tell Python what kind of stuff is inside the box.

Here’s an example:

name = "Viktor"
age = 25
is_cool = True

Now, when you type print(name) into your terminal, guess what happens? Python will spit out “Viktor” because that’s what we stored in the name variable. See? Easy peasy.

Want to show off even more?

print(f"Hi, my name is {name}, I’m {age} years old, and it’s {is_cool} that I’m cool!")

Python will respond with:

Hi, my name is Viktor, I’m 25 years old, and it’s True that I’m cool!

Which, let’s be honest, is a pretty accurate statement.

Step 4: Loops – Doing Stuff Over and Over

Imagine you need to tell your computer to do something 100 times. Are you going to type it out 100 times? No way, we’re smarter than that. Meet loops—your new best friend for lazy but efficient coding.

Let’s use a loop to print “Python is awesome!” five times:

for i in range(5):
    print("Python is awesome!")

Python will repeat your message like a parrot with a short memory:

Python is awesome!
Python is awesome!
Python is awesome!
Python is awesome!
Python is awesome!

Mission accomplished.

Now, you might be wondering about that space before print. That’s called indentation, and in Python, it’s a big deal. It’s like telling your computer, “Hey, everything indented here is part of the loop.” Without indentation, Python gets all confused and will throw an IndentationError — basically its way of saying, “I have no idea what you’re trying to do here.”

Think of it this way: indentation keeps your code organized, just like stacking your pizza slices neatly in a box. Without it, everything would be a mess, and nobody would get any pizza (or Python, for that matter).

So, whenever you’re writing code inside a loop (or a function, or an if statement), make sure to indent. It’s Python’s way of making sure everything is in the right place, just like folding your laundry (but more fun, obviously).

Try It Yourself:

Modify the loop to print “I’m learning Python!” 10 times instead of 5. Hint: Change the number inside range(5).

Step 5: Functions – Because Repeating Yourself Is So 2000s

Imagine having to write the same block of code over and over. That’s boring. Enter functions—you write the code once, and call it whenever you need it. It’s like saving your favorite snack recipe so you never forget it.

Here’s how to make a function:

def greet(name):
    print(f"Hello, {name}!")

greet("Viktor")
greet("Pythonista")

Python will politely greet you back:

Hello, Viktor!
Hello, Pythonista!

Now you can greet anyone with just one line. Neat, huh?

Conclusion

You’ve just dipped your toes into the vast, fun, and sometimes weird world of Python. From printing messages to using loops and functions, you’ve taken your first steps toward becoming a Python pro.

Stick with it, and soon you’ll be building web apps, automating tasks, or maybe even creating the next big thing! In the next lesson, we’ll dive deeper into Python’s superpowers. Until then, keep coding and stay awesome!


Want more Python goodness? Check out the rest of the course or join my WhatsApp group for even more tech fun!

Join the WhatsApp Group


Ready for more? In Lesson 2, we’ll discover why Python variables are like pizza boxes, and how data types are the toppings you can mix and match. 🍕


See also