Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jumpingchu
Created June 2, 2022 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jumpingchu/e80ef1aae074ae69c1e03b728caac606 to your computer and use it in GitHub Desktop.
Save jumpingchu/e80ef1aae074ae69c1e03b728caac606 to your computer and use it in GitHub Desktop.
PyScript demo files
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body>
<py-script>
print("Let's compute π:")
def wallis(n):
pi = 2
for i in range(1, n):
pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
return pi
pi = wallis(100000)
s = f"π is approximately {pi:.3f}"
print(s)
</py-script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment