Learn Python Python: Getting Started

Python: Getting Started

⏱ 15 min read
Python is one of the world's most popular and beginner-friendly languages. It powers data science, web development, automation, AI, and scripting.

How Python Works:
Unlike Java or C++, Python reads almost like plain English — no semicolons, no curly braces, no boilerplate.
Python is an interpreted language. You write code and run it immediately — no compiling step.
Just save your .py file and run: python hello.py (or python3 hello.py)

Breaking Down Hello World:

print("Hello, World!") — calls the built-in print function. That's it. No class, no main method.

Comments in Python:
# This is a single-line comment
"""
This is a multi-line comment (docstring).
Python won't execute this.
"""
Python ignores all comments — they are notes for humans only.

The print() Function — Options:
print("Line 1") — prints text and adds a newline
print("Same ", end='') — no newline (stays on same line)
print("Python", "is", "great", sep=" - ") — custom separator
print(f"Name: {name} | Age: {age}") — f-string: embed variables directly

Python vs Java:
In Java you need 5 lines just to print Hello World (public class, main method, System.out.println).
In Python? One line: print("Hello, World!") — that's Python's philosophy.

How to Run Python:
1. Install Python from python.org (includes pip package manager)
2. Save your file as hello.py
3. Open a terminal and run: python hello.py
Code Example
# This is a single-line comment
print("Hello, World!")
 
"""
Multi-line comment (docstring).
Python ignores everything in here.
"""
 
print("No newline here. ", end='')
print("Same line!")
 
print()  # blank line
 
print("Python", "is", "great", sep=" - ")
 
name = "Alice"
age  = 25
print(f"Hello, {name}! You are {age} years old.")
 
# Output:
# Hello, World!
# No newline here. Same line!
#
# Python - is - great
# Hello, Alice! You are 25 years old.
← Back to Course Variables and Data Types →

Log in to track your progress and earn badges as you complete lessons.

Log In to Track Progress