DEV Community

Cover image for Hello World, Meet Python! (A Beginner's Guide to Not Breaking Things)
Bonface Thuo
Bonface Thuo

Posted on

Hello World, Meet Python! (A Beginner's Guide to Not Breaking Things)

Python: Day One โ€“ The Indentation Struggle is Real (Will it ever print?)

Hey everyone! ๐Ÿ‘‹ Welcome to Day 1 of my Python journey. I've decided it's finally time to tame the snake, dive into the code, and inevitably spend 45 minutes staring at my screen because I missed a single quotation mark.

We are starting from the very beginning today. Grab a coffee, and let's get into it!


What exactly is Python? ๐Ÿค”

Before we start typing wildly, let's establish what we're actually working with. Python is a high-level, interpreted programming language. That is just a fancy, technical way of saying that the code looks a lot closer to human English than robot binary, which makes it much easier to write and run.

It is incredibly popular because of its simple and readable syntax. Plus, it's basically the Swiss Army knife of coding. You can use it for:

  • ๐Ÿ•ธ๏ธ Web development
  • ๐Ÿ“Š Data analysis
  • ๐Ÿค– Machine learning
  • โš™๏ธ Automation (making the computer do your boring tasks!)
  • ๐ŸŽฎ Game development

Our First Magic Trick: The print() Function ๐Ÿช„

The absolute most basic thing you can do in Python is command the computer to talk back to you. We do this using the print() function, which displays output straight to the console.

Here is the rite of passage for every developer:

# Basic print statement
print("Hello, World!")
print("Welcome to Python!")
print("This is your first Python program")
Enter fullscreen mode Exit fullscreen mode

Mixing it Up: Strings and Numbers

The print() function isn't just for basic text (which we call "strings"). You can print numbers, or even string multiple items together just by separating them with commas!

# Print with numbers
print(42)
print(3.14)

# Printing multiple items separated by commas
print("Python", "is", "awesome")

# Multiple values on one line
print("Age:", 25, "Name:", "Alice")
Enter fullscreen mode Exit fullscreen mode

Thatโ€™s a wrap for Day 1! We've successfully made the computer speak to us, and more importantly, we haven't broken anything yet.

Are you learning Python right now too? Let me know in the comments what you're struggling with (or what you're enjoying!) so we can suffer through the indentation errors together. ๐Ÿ๐Ÿ’ป

Top comments (0)