A browser-based Python terminal powered by Pyodide with Mac-style keyboard interface.
Interactive Python
This tool is a superb initial resource for rapidly prototyping and testing ideas, as it enables you to execute Python code right in your web browser or on a mobile device. You can conveniently save, load, and edit the history of your workbooks.
Mac Keyboard
The stylish, clickable keys, similar to those on a MacBook, are purely an aesthetic option. You can enable them for touchscreens by toggling off the 'Block KB' setting near the terminal input, though their use is optional.
Powered by Pyodide
This provides the full Python 3.x environment, including scientific packages, powered by Pyodide. Pyodide is a WebAssembly (WASM) port of CPython. This is readily available for easy integration into your own projects. Pyodide's documentation: https://pyodide.org/en/stable/
XcaliburMoon
Need help integrating this functionality into your own pages? We setup enterprise-level custom apps for you on Virtual Machines (VMs)/VPS, including a wide range of other specialized services. Visit XcaliburMoon at https://xcaliburmoon.net/
Python 3.11 - Pyodide
Python 3.11 (Pyodide) - Loading...
>>>
Enter for new line, click Run to execute
Command History
No commands yet. Start typing in the terminal.
Virtual Keyboard
Python Quick Reference
Handy Python tips and tricks for the terminal. Click to expand each section.
Note: Examples are condensed with semicolons (;) for easy terminal use. You can remove semicolons and press Enter for multi-line format. For multi-line code with indentation, ensure proper spacing (4 spaces or 1 tab per level).
Cool One-Liners+
print(*range(1, 11), sep=', ')
Print numbers 1-10 with commas
import this
The Zen of Python
import antigravity
XKCD Easter egg
print('\n'.join(sorted([f'{i}: {i**2}' for i in range(1, 6)])))
Print numbers with their squares
List Comprehensions+
squares = [x**2 for x in range(10)]
Create list of squares
evens = [x for x in range(20) if x % 2 == 0]
Filter even numbers
matrix = [[i*j for j in range(3)] for i in range(3)]
Create 2D matrix
words = [w.upper() for w in 'hello world'.split()]
Uppercase all words
F-Strings & Formatting+
name = "Python"; print(f"Hello, {name}!")
Basic f-string
pi = 3.14159; print(f"Pi: {pi:.2f}")
Format to 2 decimal places
num = 42; print(f"{num:05d}")
Zero-pad numbers (00042)
x = 10; print(f"{x=}")
Debug print (x=10)
Template Strings (PEP 750)+
from string import Template; t = Template("Hello, $name!"); print(t.substitute(name="World"))
Basic template substitution
t = Template("$who likes $what"); print(t.substitute(who="Python", what="coding"))
Multiple variables
t = Template("Price: $$${amount}"); print(t.substitute(amount=99))
Escape dollar sign with $$
t = Template("$name is ${age} years old"); print(t.safe_substitute(name="Bob"))
safe_substitute ignores missing keys
Lambda & Functional+
square = lambda x: x**2; print(square(5))
Lambda function
list(map(lambda x: x*2, [1,2,3]))
Map with lambda
list(filter(lambda x: x>5, range(10)))
Filter with lambda
from functools import reduce; reduce(lambda x,y: x+y, [1,2,3,4])
Reduce sum
Functions+
def greet(name): return f"Hello, {name}!"
Basic function
def add(a, b=10): return a + b
Function with default parameter
def stats(*nums): return sum(nums), len(nums)
Variable arguments (*args)
def info(**kwargs): return {k: v for k, v in kwargs.items()}
Keyword arguments (**kwargs)
For Loops & Iteration+
for i in range(5): print(i)
Basic for loop (0-4)
for i, val in enumerate(['a','b','c']): print(f"{i}: {val}")
Loop with index
for k, v in {'a': 1, 'b': 2}.items(): print(f"{k} = {v}")
Loop through dictionary
for x, y in zip([1,2,3], ['a','b','c']): print(x, y)
Loop two lists together
Classes & Objects+
class Dog: def __init__(self, name): self.name = name
Basic class with constructor
class Cat: def __init__(self, name): self.name = name
def meow(self): return f"{self.name} says meow!"
Class with method
class Counter: count = 0 # Class variable
def __init__(self): Counter.count += 1
Class variable (shared)
class Point: def __init__(self, x, y): self.x, self.y = x, y
def __str__(self): return f"({self.x}, {self.y})"
String representation
Operators & Tricks+
x, y = 5, 10; x, y = y, x # Swap
Swap variables
result = "Yes" if 5 > 3 else "No"
Ternary operator
nums = [1, 2, 3]; print(*nums) # Unpacking
Unpack with *
a = [1, 2]; b = [*a, 3, 4] # Spread
Spread operator
x = 10; print(5 < x < 15) # Chaining
Chained comparisons
name = input_val or "Default" # Fallback
Default value with or
File I/O (Pyodide)+
from pathlib import Path; file_path = Path("/my_file.txt"); file_path.write_text("Hello World")
Write to file using pathlib
from pathlib import Path; content = Path("/my_file.txt").read_text(); print(content)
Read from file using pathlib
with open("/data.txt", "w") as f: f.write("Line 1\nLine 2")
Write with context manager
with open("/data.txt", "a") as f: f.write("\nNew line")
Append to existing file
with open("/data.txt", "r") as f: lines = f.readlines(); print(lines)
Read all lines from file
# Note: In Pyodide, files are in-memory only. Use paths like "/myfile.txt". Files persist during session only.
Important: Files are session-only
About
This is a Python terminal interface built with modern web technologies.
Using input() with Loops
The input() function uses browser pop-ups. Always include a quit option in while loops. Clicking cancel will terminate the operation.
while True:
i = input("What is your name (q to quit)?: ")
if i.lower().strip() == "q":
break
elif i != "":
print(i)
break
Save and Load
The terminal offers two save options accessible from the Save dropdown menu:
WorkBook (.json) - Saves your command history with results and errors. This format can be loaded back into the terminal to restore your entire session, including previous outputs.
Python (.py) - Exports only the Python code from your history as a properly formatted .py module file with correct indentation. Perfect for creating reusable modules or sharing code. Note: .py files cannot be loaded back into the terminal.
Important: Only .json WorkBook files can be loaded back into the terminal using the Load button. Python .py files are for exporting code only.
This tool is an excellent starting point for quick prototyping and idea testing because it allows you to run Python code directly in your web browser or on a mobile device. Please note that this is not continuously monitored, and since the system operates locally on your machine, you must reach out to us if you encounter any issues.