Interactive Python Terminal

Write, run, and experiment with Python code directly in your browser. No installation required — powered by Pyodide.

python-terminal.py
Output will appear here... Press Ctrl+Enter to run code.

Quick Examples

Click the copy icon to paste code into the terminal

Hello World

Start with the classic first program

print("Hello, PyMastery!")
print("Welcome to interactive Python learning!")

Variables & Math

Learn variables and string formatting

# Variables and calculations
name = "Python Learner"
age = 25
years_coding = 2

print(f"Hello {name}!")
print(f"You are {age} years old")
print(f"In 5 years, you'll be {age + 5}")
print(f"You've been coding for {years_coding} years")

Lists & Loops

Explore lists and iteration

# Working with lists
languages = ["Python", "JavaScript", "Java", "C++"]
print("Programming languages:")

for i, lang in enumerate(languages, 1):
    print(f"{i}. {lang}")

# List comprehension
lengths = [len(lang) for lang in languages]
print(f"\nLanguage lengths: {lengths}")

Functions

Create and use functions

def greet(name, language="Python"):
    """Greet a programmer"""
    return f"Hello {name}! Ready to learn {language}?"

def calculate_area(length, width):
    """Calculate rectangle area"""
    return length * width

# Test the functions
message = greet("PyMastery Student")
print(message)

area = calculate_area(10, 5)
print(f"Rectangle area: {area} square units")

Pro Tips

Use Ctrl+Enter to run code quickly

Use Tab for indentation

Multi-line code is fully supported

Output appears below your code instantly

Learning Resources

Full Python Support

Complete Python 3 environment with standard library support

Instant Execution

Run code immediately without any setup or installation

Learn by Doing

Practice with real code examples and see results instantly