Nov-29-2018, 02:35 PM
A note on looping through consecutive items of a list:
for first, second in zip(the_list, the_list[1:]): if first > second: return False return TrueThat does give a performance hit because you are creating a new list. For small lists that shouldn't be a big issue. If large lists are a possibility you can use islice from itertools.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures