On 17/03/13 02:03, Christopher Emery wrote:

### Start of Code ###
def question_P_N(question, p, n):
     p = p.upper()
     n = n.upper()
     answer = input(question).upper()
     while answer not in (p, n):
         print("Your response was", answer + "!", "Please enter", p,
"or", n, "for your response!")
         answer = input(question).upper()
     return answer


Looks reasonable to me.
You could use string formatting instead of the addition/concatenation in the print line but otherwise it's OK.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to