Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
🟢 Beginner  ·  Lesson 03

Hello World Program in Python

In this lesson: Write and run your first Python program — print("Hello World"), how it works and common errors — with output.

The First Program

Every programmer's journey begins with printing "Hello, World!". It proves your Python setup works and teaches the most-used function: print().

Program 1: Hello World

Python – hello.py
print("Hello, World!")
Hello, World!

Save this as hello.py and run it. print() sends whatever is inside the brackets to the screen.

Program 2: Print Multiple Lines

Python – lines.py
print("Welcome to Python")
print("This is line 2")
print("Learning is fun")
Welcome to Python This is line 2 Learning is fun

Each print() automatically moves to a new line. You can also use \n inside one string to break lines.

Program 3: print() Tricks (sep and end)

Python – print_tricks.py
# sep changes the separator between items
print("2026", "06", "01", sep="-")

# end changes what comes after (default is newline)
print("Loading", end="...")
print("Done")
2026-06-01 Loading...Done
  • sep="-" puts a dash between the items instead of a space.
  • end="..." stops the line from breaking and adds "..." instead.
  • So the next print continues on the same line.

How print() Works

  • Items separated by commas are printed with a space between them by default.
  • sep controls what goes between items.
  • end controls what goes after the whole line (default \n).

Common Mistakes

  • Forgetting the quotes: print(Hello) causes a NameError.
  • Using smart/curly quotes from Word instead of straight quotes.
  • Wrong file extension — save as .py.

Practice Tasks

  1. Print "Hello" and your name on the same line using end.
  2. Print today's date as DD/MM/YYYY using sep="/".
  3. Print a 3-line poem with one print() using \n.

Summary

  • print() displays output on screen.
  • Each print starts a new line by default.
  • sep = separator between items; end = what comes after the line.

Frequently Asked Questions

How do I run my first Python program?
Save the line print("Hello, World!") in a file named hello.py and run python hello.py (or python3 hello.py) in the terminal, or press Run in IDLE, VS Code or Google Colab.
Why does print need brackets in Python 3?
In Python 3, print is a function, so its arguments go inside parentheses. print "Hi" without brackets was Python 2 syntax and gives a SyntaxError now.
Is Python case-sensitive?
Yes. Print and print are different names; only print (lowercase) is the built-in function.
← Back to Python Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

💻 Live Code Editor

This page's programs are ready here — run them, edit them, and learn. No installation needed.
Powered by OneCompiler. The code loads into the editor automatically — press Run to see the output. If the editor does not open, open it in a new tab.
Next topicPython Syntax, Indentation and Comments Your progress: 3 / 66 (5%) · Lesson 4 / 66 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free