Python Playground

Chạy Python code trực tiếp trên trình duyệt

Code Editor
Loading...
Output

Output sẽ hiển thị ở đây

Ví dụ Code

Basic Math

a = 10
b = 20
print(f"Sum: {a + b}")
print(f"Product: {a * b}")

Lists

numbers = [1, 2, 3, 4, 5]
print(f"List: {numbers}")
print(f"Sum: {sum(numbers)}")
print(f"Max: {max(numbers)}")

Functions

def factorial(n):
    if n <= 1:
        return 1
    return n * factorial(n-1)

print(f"5! = {factorial(5)}")