Python Hello World on a Raspberry Pi

The next logical step after the last post is to created a python “Hello World” app on my Raspberry Pi.

Lets try Chat GPT this time, you have probably already figured out the Claude excels at these tasks.

We are going to reuse the same prompt as last time with a couple of changes:

Create a step by step guide, writing a “Hello World” program in Python, use IDLE, on my Raspberry Pi, assume the reader has zero knowledge of Python and or this project. I want to remote in via the built in VNC feature on the Rasberrian OS

One of the things you notice first is that the results do not come in that nifty right sidebar with a complete code download button out of the box.

I did ask for a nicer version.

🐍 Raspberry Pi Python β€œHello World” Guide

Using VNC + IDLE (Beginner Friendly)


🎯 Goal

By the end of this guide, you will:

  • Connect to your Raspberry Pi remotely
  • Open Python’s editor (IDLE)
  • Write your first program
  • Run it and see:
    Hello, World!

🧰 What You Need

  • Raspberry Pi with Raspberry Pi OS
  • VNC enabled on the Pi
  • Another computer with VNC Viewer installed
  • IDLE available in the Raspberry Pi menu

🌐 Step 1: Connect to Your Raspberry Pi (VNC)

  1. Open VNC Viewer on your computer
  2. Enter your Pi’s IP address
  3. Click Connect
  4. Log in with your Pi username and password

βœ… You should now see your Raspberry Pi desktop


πŸ–₯️ Step 2: Open Python (IDLE)

  1. Click the Raspberry Pi menu (top-left corner)
  2. Go to Programming
  3. Click IDLE or Python 3 (IDLE)

πŸ’‘ A window called Python Shell will open β€” this is normal


πŸ“„ Step 3: Create a New Python File

  1. In the Python Shell window, click File
  2. Click New File

πŸͺŸ A blank editor window will appear


✍️ Step 4: Write Your First Program

Type this exactly:

print("Hello, World!")

⚠️ Be careful with:

  • Parentheses ( )
  • Quotation marks " "
  • Spelling of print

πŸ’Ύ Step 5: Save Your File

  1. Click File β†’ Save
  2. Choose a location (Desktop is fine)
  3. Name the file:
hello.py
  1. Click Save

▢️ Step 6: Run the Program

  1. Click Run β†’ Run Module
    (or press F5)

πŸŽ‰ Step 7: See the Result

Look at the Python Shell window.

You should see:

Hello, World!

βœ… Success! Your first program worked.


🧠 What Did You Just Do?

print("Hello, World!")
  • print β†’ tells Python to display something
  • "Hello, World!" β†’ the message

πŸ‘‰ Together: show this message on the screen


πŸ§ͺ Try This Next

Change your message:

print("Hello from my Raspberry Pi!")

Save and run again.


⚠️ Common Mistakes

❌ Missing quotes

print(Hello, World!)

βœ… Correct

print("Hello, World!")

❌ Misspelling print

prit("Hello")

βœ… Correct

print("Hello")

❌ Forgot to save before running

βœ” Always save before pressing F5


πŸ› οΈ Troubleshooting (If IDLE Is Missing)

1. Check Python

Open Terminal:

python3 --version

If you see a version β†’ Python is installed βœ”


2. Try launching IDLE manually

idle

or

idle3

3. If IDLE is not installed

sudo apt update
sudo apt install idle -y

Then try again:

idle

4. If it still doesn’t appear in the menu

sudo reboot

⚑ Quick Version (Cheat Sheet)

  1. Open VNC Viewer β†’ connect to Pi
  2. Menu β†’ Programming β†’ IDLE
  3. File β†’ New File
  4. Type:
print("Hello, World!")
  1. Save as hello.py
  2. Press F5
  3. Look for:
Hello, World!

πŸš€ What’s Next?

Try:

name = "Your Name"
print("Hello, " + name)


πŸ’‘ You’ve just written your first Python program β€” nice work.

Success! We now have a hello world program written in Python on a Raspberry Pi!