itertools.dropwhile skips elements of the sequence, until the condition returns True, and then returns the rest, starting from the first, for which the condition became FalseNote: no element will be returned until the predicate returns
False at least onceExample:
>>> import itertools
>>> purchase_price = 99.00
>>> daily_prices = [95, 97, 94, 96, 100, 102, 99]
>>> prices_after_gain = list(itertools.dropwhile(lambda price: price <= purchase_price, daily_prices))
prices_after_gain
[100, 102, 99]https://t.me/DataScience4 🌟
