print("This is my first attempt with PyScript")
def compute_pi(n):
pi = 2
for i in range(1,n):
pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
return pi
pi = compute_pi(100000)
s = f"Pi is approximately {pi:.3f}"
print(s)
Matplotlib
- matplotlib
import matplotlib.pyplot as plt
import numpy as np
print('This is my first try at some graphics content')
y = np.array([1,2,3,4,5,5])
x = np.array([0.2,1,2,3,4,5])
fig1, ax1 = plt.subplots()
ax1.plot(x,y)
ax1.set_aspect('equal')
fig1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.