MCPcopy Create free account
hub / github.com/ActiveState/code / get_answer

Function get_answer

recipes/Python/456374_Crypt/recipe-456374.py:58–72  ·  view source on GitHub ↗

Receives selection. Gets an answer. Handles errors. Returns answer.

()

Source from the content-addressed store, hash-verified

56 print
57
58def get_answer():
59 '''Receives selection.
60
61 Gets an answer.
62 Handles errors.
63 Returns answer.'''
64 while True:
65 try:
66 answer = int(raw_input('Please make a selection: '))
67 if answer is 1 or answer is 2 or answer is 3 or answer is 4:
68 print
69 return answer
70 except:
71 pass
72 print 'You must enter 1, 2, 3, or 4 as a selection.'
73
74def create_key():
75 '''Generates a key.

Callers 1

menuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected