Adding number to a list and have it increase

I am having trouble storing multiple float values and adding them to a list to let it expand. I am getting the error "'float' object is not iterable"...

while True:

    #some code here

    value_list = [value]
    value_list.extend(value)
    print("saving list", value_list)
    print("max", max(price_list))

    time.sleep(600)

value is scraping data from a website that I own with certain prices and it is converting it to float and the shared code is in a while True statement to show if the price changes overtime, then I want it to display the highest value from the stored list.

Answers 1

  • As suggested in the comment, you would do something like this:

    value_list = []
    
    while True:
    
        #some code here
    
        value_list.append(value)
        print("saving list", value_list)
        print("max", max(price_list))
    
        time.sleep(600)
    

Related Articles