python package icon
python/python

wasi

Public
wasmer run python/python

Python

Python is now compiled to WebAssembly and WASI, so it can run in your server or in your browser.

$ python
Python 3.6.7 (default, Feb 14 2020, 03:17:48)
[Wasm WASI vClang 9.0.0 (https://github.com/llvm/llvm-project 0399d5a9682b3cef7 on generic
Type "help", "copyright", "credits" or "license" for more information.
>>>

Examples

Here are a few examples of Python programs that you can try:

Hello World

This is a program that reads the input and prints it:

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

Mandlebrot

A mandlebrot program:

w = 40.0
h = 25.0

def mandel():
    y = 0.0
    while y < h:
        x = 0.0
        while x < w:
            Zr, Zi, Tr, Ti = 0.0, 0.0, 0.0, 0.0
            Cr = 2 * x / w - 1.5
            Ci = 2 * y / h - 1.0

            i = 0
            while i < w and Tr + Ti <= 4:
                Zi = 2 * Zr * Zi + Ci
                Zr = Tr - Ti + Cr
                Tr = Zr * Zr
                Ti = Zi * Zi
                i += 1

            if Tr + Ti <= 4:
                print('*', end='')
            else:
                print('.', end='')

            x += 1
            yield

        print()
        y += 1
        yield

# run the mandelbrot

try: from browser import request_animation_frame
except: request_animation_frame = None

gen = mandel()
def gen_cb(_time=None):
    for _ in range(4): gen.__next__()
    request_animation_frame(gen_cb)
if request_animation_frame: gen_cb()
else: any(gen)

Python is an interpreted, high-level, general-purpose programming language


Github
More packages
Browser site for python.
python web shell
christoph avatar
christoph
christoph avatar
christoph
kmpartner/python-docs py worker
kmpartner
kmpartner
kmpartner
kmpartner
python web shell
Pxlmastr
Pxlmastr
Pxlmastr
Pxlmastr
python web shell
zegevlier avatar
zegevlier
zegevlier avatar
zegevlier
python web shell
Igor
Igor
Igor
Igor
Description for package python-on-the-web
habuayush avatar
habuayush
habuayush avatar
habuayush
python web shell
Rudra
Rudra
Rudra
Rudra
bianpratama/lab-python py worker
l3au/python-demo py worker

Making software universally accessible