Guest User

Untitled

a guest
Sep 3rd, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. DAY_NAME_TO_ORDER = {
  2.     "monday": "first",
  3.     "tuesday": "second",
  4.     "wednesday": "third",
  5.     "thursday": "fourth",
  6.     "friday": "fifth",
  7.     "saturday": "sixth",
  8.     "sunday": "seventh"
  9. }
  10.  
  11. g = raw_input("What day are you leaving on?? ")
  12.  
  13. matching_days = filter(lambda x: x in g.lower(), DAY_NAME_TO_ORDER.keys())
  14.  
  15. if len(matching_days):
  16.     selected_day = matching_days[0]
  17.     print("That's a {0} day of the week".format(
  18.         DAY_NAME_TO_ORDER[selected_day]))
  19. else:
  20.     print("I don't know what day that is!")
  21.  
  22.  
  23. raw_input("PRESS ENTER TO CLOSE.")
Advertisement
Add Comment
Please, Sign In to add comment