[Tutor] Error in Game

2013-07-02 Thread Jack Little
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?___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Error in Game

2013-07-02 Thread Alan Gauld

On 02/07/13 21:22, 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.


So what does it do?


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()


Have you tried putting some debug print statement in?
For example

  
  if final1.lower()=="y":
  print 'going to shop2'
  shop2()
  elif final1.lower()=="n":
  print 'advancing'
  lvl4()

And in the shop2() and lvl4() functions a print to
show you got there?

Just some ideas.

--
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


Re: [Tutor] Error in Game

2013-07-02 Thread Joel Goldstick
On Tue, Jul 2, 2013 at 4:22 PM, 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()
>
>
What does 'upgrade' have to do with this code?
when you run this code, what is the traceback ?
How do you know the code is correct?  Isn't the definition of the code
being correct, that it will perform the logic you intended?

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


-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor