Created
January 29, 2014 07:45
-
-
Save hyponymous/8683473 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
# | |
# File: wason.py | |
# Author: Michael David Plotz | |
# Date: Thu Jan 9 23:15:20 PST 2014 | |
# | |
import re | |
def is_num(arg): | |
try: | |
int(arg) | |
except ValueError: | |
return False | |
return True | |
def main(): | |
while True: | |
try: | |
user_input = raw_input() | |
except EOFError: | |
break | |
# remove whitespace and split by commas | |
values = re.split("(?:\s|,)+", user_input) | |
# remove empty fields | |
values = [val for val in values if val != ""] | |
# ensure valid input | |
if len(values) != 3: | |
continue | |
values = [int(val) for val in values if is_num(val)] | |
if len(values) != 3: | |
continue | |
# apply the rule | |
if values[0] < values[1] and values[1] < values[2]: | |
print "Yes" | |
else: | |
print "No" | |
if __name__ == '__main__': main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment