Skip to content

Setting Up Your First Python Script

Alright, you've installed Python, survived the Version Wars (Python 3 FTW), and now you’re staring at your screen thinking:

“So uh… what do I do with this thing?”

Well, my curious code wizard, it’s time to write your first Python script — a digital “Hello!” from your computer to the world. Or maybe a sarcastic one. We don't judge.

Step 1: Open a Text Editor (No, Not MS Word 😬)

You need something simple but code-friendly:

  • 🟢 VS Code (fancy and smart)
  • 🟡 Sublime Text (quick and slick)
  • 🔵 Notepad++ (for Windows purists)
  • 🔴 Nano/Vim (for terminal ninjas)

Or if you’re feeling wild:
Yes, even plain old Notepad can work… just don’t let any senior devs see you doing it.

Step 2: Create a New File

  • Make a new file and call it:
bash
hello.py

Why .py? Because it tells your computer,

“Hey, I’m about to get Pythonic up in here.”

Step 3: Type Your First Spell

Inside hello.py, type this:

python
print("Hello, world!")

This is the programming equivalent of learning to wave your wand and not poking your own eye out.

Save the file. Yes, that’s important. We’ve all run a blank script before and questioned our life.

Step 4: Run That Baby!

Open your terminal or command prompt.

Navigate to where your hello.py file lives:

bash
cd path/to/your/file

Now run it:

Windows:

bash
python hello.py

macOS / Linux:

bash
python3 hello.py

Output:

bash
Hello, world!

🎉 Ta-da! You’ve written your first Python script. You officially made a machine say hello without using ChatGPT.

But... What Just Happened?

The print() function tells Python to show something on the screen. Like a megaphone, but with less yelling and more code.

You can also try:

python
print("My name is Kahnu and I'm cooler than semicolons.")
print(42)
print("2 + 2 =", 2 + 2)

Python’s chill like that — it just rolls with whatever you give it.

Bonus: The Mistake Everyone Makes

If you accidentally write:

python
print "Hello"

Python 3 will scream at you like:

bash
SyntaxError: Missing parentheses in call to 'print'

That’s Python’s polite way of saying:

“Nice try, but this isn’t Python 2. Get modern.”

Built by noobs, for noobs, with love 💻❤️