Getting Started with Python

Welcome to Python! In this tutorial, you'll write your first program and learn the fundamentals that every Python developer needs to know.

Your First Program

The classic first program in any language is "Hello, World!" — in Python, it's just one line:

print("Hello, World!")

Try it yourself in the playground below:

Python Playground
Output
Click "Run" to execute your code

What is Python?

Python is a high-level, interpreted programming language known for its clean syntax and readability. It's used for:

  • Web development (Django, Flask, FastAPI)
  • Data science (pandas, NumPy, matplotlib)
  • Machine learning (scikit-learn, TensorFlow, PyTorch)
  • Automation and scripting
  • And much more

Comments

Comments let you add notes to your code. Python ignores everything after a #:

# This is a comment
print("This runs")  # This is an inline comment

Basic Math

Python works as a calculator out of the box:

print(2 + 3)       # Addition: 5
print(10 - 4)      # Subtraction: 6
print(3 * 7)       # Multiplication: 21
print(15 / 4)      # Division: 3.75
print(15 // 4)     # Floor division: 3
print(2 ** 10)     # Exponentiation: 1024
print(17 % 5)      # Modulo (remainder): 2

Python Playground
Output
Click "Run" to execute your code

The input() Function

You can get input from the user with input():

name = input("What is your name? ")
print(f"Hello, {name}!")

Note: The input() function won't work in the browser playground since it requires interactive terminal input. In a real Python environment, it pauses and waits for the user to type something.

What's Next?

Now that you've written your first Python code, continue to the next tutorial to learn about variables and data types — the building blocks of every program.