PyScript: Python in the Browser

Post Reply
User avatar
Eli
Senior Expert Member
Reactions: 183
Posts: 5283
Joined: 9 years ago
Location: Tanzania
Has thanked: 75 times
Been thanked: 88 times
Contact:

#1

Thanks to Anaconda and other giants for this amazing possibility - Python in the browser!

Temporarily disabled PyScript for improvement.

You ca still use Python here

0
TSSFL -- A Creative Journey Towards Infinite Possibilities!
User avatar
Eli
Senior Expert Member
Reactions: 183
Posts: 5283
Joined: 9 years ago
Location: Tanzania
Has thanked: 75 times
Been thanked: 88 times
Contact:

#2

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):

  1. X = [7,9,5,3,2,4,5,0]
  2.  
  3. def current_max(X):
  4.     m = 0
  5.     for i in X[::-1]:
  6.         m = max(m, i)
  7.         yield m
  8. N_int = sum([x>y for x,y in zip(X[-2::-1], current_max(X))])
  9. print(N_int)


  1. import matplotlib.pyplot as plt
  2. x = [7,9,5,3,2,4,5,0]
  3. y = [7,9,5,3,2,4,5,0]
  4. fig, ax = plt.subplots()
  5. ax.scatter(x, y)
  6. fig

0
TSSFL -- A Creative Journey Towards Infinite Possibilities!
Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “Technologies for Teaching, Learning, Research, Problem Solving and Business”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest