[Tutor] Error in Game

Prasad, Ramit ramit.prasad at jpmorgan.com
Tue Jul 2 23:22:41 CEST 2013


Jack Little wrote:
> The player has an option to upgrade or not. I know the code is correct, but it doesn't send the player
> to the shop. Here is the code:
> 
> def lvl3_2():
>     print "You beat level 3!"
>     print "Congratulations!"
>     print "You have liberated the Bristol Channel!"
>     print "[Y] to go to the shop or [N] to advance."
>     final1=raw_input(">>")
>     if final1.lower()=="y":
>         shop2()
>     elif final1.lower()=="n":
>         lvl4()
> 
> 
> 
> Help?

Obviously the code must not be correct or it would send the player to the shop. :)
What happens when you enter "y" or "n"? What do you expect to happen? Do you see
any exceptions being printed?

I wonder if some space, new line, or unprintable character is being captured 
unintentionally. Have you tried to `print repr(final1)`?


~Ramit Prasad


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list