Page 1 of 1
JupyterLite and PyScript: Python in the Browser
Posted: Sun May 01, 2022 9:29 pm
by Eli
Thanks to
Anaconda and other giants for this amazing possibility - Python in the browser!
Temporarily disabled PyScript for improvement.
You can still use Python here
JupyterLite
Sage Cell
Re: PyScript: Python in the Browser
Posted: Tue May 03, 2022 5:04 pm
by Eli
Test These examples
Given the
list of integers, X, write code to count how many integers are strictly larger than all the integers to their right. Exclude the last digit since it doesn’t have a number to its right. E.g. for [2,3,1] the answer should be 1 while for [12,4,4,2,2,3] the answer is 2.
In Python the code may look like (Use other languages):
X = [7,9,5,3,2,4,5,0]
def current_max(X):
m = 0
for i in X[::-1]:
m = max(m, i)
yield m
N_int = sum([x>y for x,y in zip(X[-2::-1], current_max(X))])
print(N_int)
import matplotlib.pyplot as plt
x = [7,9,5,3,2,4,5,0]
y = [7,9,5,3,2,4,5,0]
fig, ax = plt.subplots()
ax.scatter(x, y)
fig