Created
August 9, 2012 17:03
-
-
Save mutaku/3305924 to your computer and use it in GitHub Desktop.
make sure all sublists are only one element - iterable version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def checkpossibility(unsatlist): | |
try: | |
for x in sorted(unsatlist, key=len, reverse=True): | |
if len(x) > 1: | |
raise Exception | |
else: | |
pass | |
return True | |
except: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def checkpossibility(unsatlist):
for x in sorted(unsatlist, key=len, reverse=True):
if len(x) > 1:
return False
else:
pass
return True