Utilrix

Online Python Compiler

Run real CPython in your browser — the full standard library, input(), tracebacks with line numbers, nothing uploaded.

Runs entirely on your device— nothing is uploaded, so processing uses your own CPU and memory. Large files can take a while (don't worry, it hasn't frozen), and very large files may be slow or crash the tab on phones — for big files, use a desktop or laptop.First run downloads about 12MB — the model is cached after that, so later runs start instantly. Best on Wi-Fi.
1:1
OUTPUT

Press Run — output appears here. Everything executes in this tab, so nothing is uploaded and there is no queue to wait in.

Real CPython via WebAssembly, running in this tab. The runtime downloads once (about 12MB) and is then cached.

Python examples you can run

Every one of these is loaded from the Examples menu in the editor above — press Run and it works. They are printed here so you can read the code before you run it.

Lists & comprehensions

A list of dicts, a list comprehension, max with a key function, and an f-string — the core of everyday Python.

users = [
    {"name": "Vivek", "role": "admin", "score": 92},
    {"name": "Rahul", "role": "editor", "score": 78},
    {"name": "Amit", "role": "viewer", "score": 65},
]

names = [user["name"] for user in users]
print(names)

top = max(users, key=lambda user: user["score"])
print(f"Top scorer: {top['name']} with {top['score']}")

total = sum(user["score"] for user in users)
print("Average:", round(total / len(users), 2))

Reading input

Reading and converting input(), then branching on it. Values come from the Input panel, one per line.

name = input("What is your name? ")
age = int(input("How old are you? "))

print(f"Hello, {name}!")
print(f"Next year you turn {age + 1}.")

if age >= 18:
    print("You can vote.")
else:
    print(f"{18 - age} years to go.")

Classes & dataclasses

A dataclass with a default_factory, a @property, and sorting instances by a computed value.

from dataclasses import dataclass, field


@dataclass
class Student:
    name: str
    marks: list[int] = field(default_factory=list)

    @property
    def average(self) -> float:
        return sum(self.marks) / len(self.marks) if self.marks else 0.0

    def grade(self) -> str:
        avg = self.average
        if avg >= 90:
            return "A"
        if avg >= 75:
            return "B"
        return "C"


students = [
    Student("Vivek", [92, 88, 95]),
    Student("Rahul", [70, 78, 74]),
    Student("Amit", [88, 91, 79]),
]

for student in sorted(students, key=lambda s: s.average, reverse=True):
    print(f"{student.name:<8} {student.average:6.2f}  {student.grade()}")

Standard library

Counter, defaultdict, json, math and datetime — the standard library doing the heavy lifting.

import json
import math
import random
from collections import Counter, defaultdict
from datetime import date

random.seed(42)

words = "the quick brown fox jumps over the lazy dog the fox".split()
counts = Counter(words)
print("Most common:", counts.most_common(3))

groups = defaultdict(list)
for word in words:
    groups[len(word)].append(word)
print("By length:", dict(sorted(groups.items())))

print("Payload:", json.dumps({"pi": round(math.pi, 4), "today": str(date(2026, 8, 24))}))
print("Sample:", random.sample(range(100), 5))

Algorithms practice

Binary search, a palindrome check with a slice reversal, and a Fibonacci generator with yield.

def binary_search(items, target):
    low, high = 0, len(items) - 1
    while low <= high:
        mid = (low + high) // 2
        if items[mid] == target:
            return mid
        if items[mid] < target:
            low = mid + 1
        else:
            high = mid - 1
    return -1


def is_palindrome(text):
    cleaned = [char.lower() for char in text if char.isalnum()]
    return cleaned == cleaned[::-1]


def fib(limit):
    a, b = 0, 1
    while a < limit:
        yield a
        a, b = b, a + b


numbers = sorted([15, 3, 42, 8, 23, 4, 16])
print("Sorted:", numbers)
print("Index of 23:", binary_search(numbers, 23))
print("Palindrome:", is_palindrome("A man, a plan, a canal: Panama"))
print("Fibonacci:", list(fib(100)))

Python quick reference

The syntax people look up most often. Copy any line into the editor above to see what it does.

Data structures

WhatSyntaxNotes
List[1, 2, 3]Ordered, mutable, allows duplicates.
Tuple(1, 2, 3)Ordered, immutable — usable as a dict key.
Dict{"a": 1}Key to value; insertion ordered since 3.7.
Set{1, 2, 3}Unique, unordered; fast membership tests.
Comprehension[x * 2 for x in items if x > 0]Build a list in one expression.
Dict comprehension{k: len(k) for k in words}Same idea, for dicts.
Unpackfirst, *rest = itemsSplits a sequence in one line.

Strings and formatting

WhatSyntaxNotes
f-stringf"{name} is {age}"The modern way to interpolate.
Number formatf"{value:,.2f}"Thousands separator, two decimals.
Paddingf"{name:<10}"Left align in ten columns; > right, ^ centre.
Split / join",".join(parts)join is a string method, not a list one.
Striptext.strip()Removes leading and trailing whitespace.
Slicetext[::-1]Reverses a string or list.

Control flow and functions

WhatSyntaxNotes
enumeratefor i, item in enumerate(items)Index and value together.
zipfor a, b in zip(xs, ys)Walk two sequences in step.
Sort by keysorted(items, key=lambda x: x.age, reverse=True)Returns a new list.
Default argsdef f(items=None)Never use a list or dict as a default.
Kwargsdef f(**options)Collects keyword arguments into a dict.
Guardif __name__ == "__main__":Runs only when executed directly.
Exceptionstry / except ValueError as errorCatch the specific type, not bare except.

Other languages you can run here

Processed 100% in your browser — nothing you enter here is ever uploaded.

Common use cases

Learning Python without installing it

Real CPython in the browser — no interpreter to install, no PATH to fix, no virtualenv. Useful on a school or office machine where you can't install software.

Practising DSA and interview questions

input() reads from a panel the way a judge feeds stdin, so recursion, sorting and two-pointer problems can be practised exactly as they are posed.

Checking a snippet from a tutorial

Paste the code from a blog post or a course and see what it actually prints, instead of trusting the screenshot.

Teaching

Share a link that already contains the code — no setup step between you and a class of thirty different laptops.

How to use the Python Compiler

Write or paste Python in the editor and press Run, or hit Ctrl + Enter. The first run downloads the Python runtime (about 12MB) — after that it is cached and starts in under a second.

print() output appears in the console on the right exactly as it would in a terminal, f-strings, format specifiers and all.

If your code raises, the traceback is shown with the line number. Click it to jump the cursor to that line.

input() reads from the Input panel — type one value per line, in the order your program asks for them.

Suggestions cover the built-in functions and the common list, dict, set and string methods; press Ctrl + Space to ask for them, or turn them off in the Editor panel.

Press ZIP to download main.py with a README, or Share to copy a link that carries your code inside it.

Frequently asked questions

Related tools