> From: Joel Montes de Oca <joelmonte...@gmail.com>
> To: Tutor Python <tutor@python.org>
> Subject: [Tutor] Paper Rock Scissors game - User's choice not returned
>        properly
> Message-ID: <4eaec191.3060...@gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> Hello everyone,
>
>
> The function: ( http://dpaste.com/644857/)
>
> def  UserChoice  ():    # The function that returns the choice from the
> user
>        print  'Please select (P) for paper, (R) for Rock, or (S) for
> Scissors.'
>        choice  =  raw_input('What is your selection?:')
>
>        if  choice.lower()  not  in  ('p',  'r','s'):   # Converts the
> user's choice to lowercase and confirms the choice is valid
>                print  'I am sorry, you entered\''  +  choice.upper()  +
>  '\'  which is an invalid response. Please try again.'
>                raw_input('Press Enter to try again.')
>
               UserChoice  ()          # If the choice is not valid, run
> the function over
>

You should use
return UserChoice()


>        else:
>                return  choice
>
>
Asokan Pichai
SVP - Learning and Development

“Faith consists in believing when it is beyond the power of reason to
believe. "
 Voltaire <http://www.brainyquote.com/quotes/quotes/v/voltaire163832.html>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to