Oct-05-2021, 06:38 PM
(Oct-05-2021, 06:20 PM)tomtom Wrote:(Oct-05-2021, 03:33 PM)menator01 Wrote:Thank you so much sir, but the len of the list is not fixed it will be determine by the bars the traded cryptocurrencynan = 0 mylist = [438.4, 439.18, 439.9, 440.21999999999997, 440.38, 441.08000000000004, nan, nan, nan, nan] for i in range(len(mylist)): if i >= 6: mylist.pop() print(mylist)
Output:[438.4, 439.18, 439.9, 440.21999999999997, 440.38, 441.08000000000004]
This will not matter the list length. You should use one of the more experienced programmers suggestions though.
#! /usr/bin/env python3 nan = 0 mylist = [438.4, 439.18, 439.9, 440.21999999999997, 440.38, 441.08000000000004, nan, nan, nan, nan] for i in range(len(mylist)): if 0 in mylist: mylist.pop() print(mylist)
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags