Created
June 2, 2022 08:15
-
-
Save jumpingchu/e80ef1aae074ae69c1e03b728caac606 to your computer and use it in GitHub Desktop.
PyScript demo files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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