Skip to content

Instantly share code, notes, and snippets.

@hyponymous
Created January 29, 2014 07:45
Show Gist options
  • Save hyponymous/8683473 to your computer and use it in GitHub Desktop.
Save hyponymous/8683473 to your computer and use it in GitHub Desktop.
#!/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