Hello World & Your First Python Script
Starting with Python? Great choice! One of the most beginner-friendly languages out there. The first step in your coding journey is writing a simple script that says "Hello, World!"
In this tutorial, you'll write 5 different beginner-friendly Python scripts to help you get comfortable with syntax and execution.
Example 1: Basic Hello World
print("Hello, World!")
This is the most basic Python script. Run it to confirm Python is set up correctly on your machine.
Example 2: Personalized Greeting
name = "Alice"
print("Hello,", name + "!")
This script introduces a variable and string concatenation. Try changing the name!
Example 3: Multilingual Hello World
print("Hello, World!") # English
print("Hola, Mundo!") # Spanish
print("Bonjour, le monde!") # French
print("नमस्ते दुनिया!") # Hindi
print("こんにちは世界!") # Japanese
This version prints greetings in multiple languages. Notice how Python supports Unicode characters.
Example 4: Using a Function
def greet(name):
print("Hello,", name + "!")
greet("Gaurang")
greet("World")
This example introduces functions — reusable blocks of code. Great for organizing logic.
Example 5: Hello World in a Loop
for i in range(5):
print("Hello, World!", i+1)
Now you're using loops! This prints the message 5 times with numbers.
How to Run Your Python Scripts
1. Save the code to a file named hello.py
2. Open terminal or command prompt
3. Run the script using:
python hello.py
Final Thoughts
Learning Python starts with small wins — like printing text to the screen. Once you're confident with basic syntax, you can move on to working with input, logic, data, and eventually building real apps.