Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with a call
#3
A variation that only supposes that self.deck is iterable
from itertools import tee

def is_ordered(self):
    t = tee(self.deck)
    next(t[1], None)
    return all(a <= b for a, b in zip(*t))
Reply


Messages In This Thread
help with a call - by PyPy - Nov-23-2019, 08:52 PM
RE: help with a call - by Larz60+ - Nov-23-2019, 11:27 PM
RE: help with a call - by Gribouillis - Nov-24-2019, 08:33 AM
RE: help with a call - by PyPy - Nov-24-2019, 11:24 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020