yesOrNo.py

def yes_or_no(question): reply = str(raw_input(question+' (y/n): ')).lower().strip() if reply[0] == 'y': return True if reply[0] == 'n': return False else: return yes_or_no("Uhhhh... please enter ")
Dead simple python function for getting a yes or no answer.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.