PyScript Test

このページを参考にしました。
“Getting started with PyScript”


Run Python

Sample

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

def ifrom(n):
    while True:
        yield n
        n += 1

def sieve(n, xs):
    for i in xs:
        if i % n != 0:
            yield i

def primes():
    xs = ifrom(2)
    while True:
        n = next(xs)
        yield n
        xs = sieve(n, xs)  

[p for i, p in zip(range(20), primes())]

REPL