[Tutor] Error in Game
bob gailer
bgailer at gmail.com
Wed Jul 3 15:33:20 CEST 2013
On 7/2/2013 4:22 PM, Jack Little wrote:
> I know the code is correct
As Joel said- how could it be, since you do not get the desired results?
When posting questions tell us:
- what version of Python?
- what operating system?
- what you use to edit (write) your code
- what you do to run your code
copy and paste the execution
> , 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()
It is a good idea to add an else clause to handle the case where the
user's entry does not match the if or elif tests.
It is not a good idea to use recursion to navigate a game structure. It
is better to have each function return to a main program, have the main
program determine the next step and invoke it.
>
>
>
> Help?
Since we are volunteers, the more you tell us the easier it is for us to
do that.
--
Bob Gailer
919-636-4239
Chapel Hill NC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130703/66ac63cd/attachment.html>
More information about the Tutor
mailing list