Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6968263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:25:46+00:00 2026-05-27T16:25:46+00:00

I’ve generated a graph of random numbers (standard deviation 1, mean 0). I need

  • 0

I’ve generated a graph of random numbers (standard deviation 1, mean 0). I need to run through the list and print out each number if it is the biggest one currently seen. For example, given the list [10, 5, 15, 18, 5, 7, 9, 100], the code would print out:

10 (first number is always going to be the biggest currently seen)
15
18
100

Here’s my code:

import pylab
a = pylab.arange(1.0, 129.05, 1)
xrandn = pylab.zeros(129, float)

for j in range(0, 129):
    xrandn[j] = pylab.randn()

pylab.plot(a, xrandn, "r-")
pylab.xlabel("Year")
pylab.ylabel("Units")
pylab.title("Possible Tempertaure Fluctuations")
pylab.show()

Also, as an extra, how could I mark these points on the graph itself?

Edit 1:
thanks for your replies, im now stuck on the following

I now need to generate a large number of random number “sets” from which I need to be able to retrieve the maximum value of the first value in every set and there after be able to access the second value of every set, then the third in every set etc counting the numbers of values that exceed the previous maximum. I have tried creating a matrix to do this for me, however I keep getting the error message telling me I cant use floating numbers within a matrix, and I am now unsure if this is the correct method or if some sort of amendment to the previous code will yield the answer .

import pylab

def make_list(size):
    """create a list of size number of zeros"""
    mylist = []
    for i in range(size):
        y = pylab.randn()
        mylist.append(y)
    return mylist

def make_matrix(rows, cols):
    """
    create a 2D matrix as a list of rows number of lists
    where the lists are cols in size
    resulting matrix contains zeros
    """
    matrix = []
    for i in range(rows):
        matrix.append(make_list(cols))
    return matrix

mx = make_matrix(10, 6)

print(mx)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:25:47+00:00Added an answer on May 27, 2026 at 4:25 pm

    As simple as it can be

    def foo(data):
        lastMax=[data[0]]
        for x in data[1:]:
            if x>lastMax[-1]:
                lastMax.append(x)
        return lastMax
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
In my XML file chapters tag has more chapter tag.i need to display chapters
I would like to run a str_replace or preg_replace which looks for certain words
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.