Please provide a meaningful subject!

"David Merrick" <merrick...@gmail.com> wrote ># Blackjack

class BJ_Game(object):
   """ A Blackjack Game. """
   def __init__(self, names):
       self.players = []
       for name in names:
           player = BJ_Player(name)
           self.players.append(player)

       self.dealer = BJ_Dealer("Dealer")

       self.deck = BJ_Deck()
       self.deck.populate()
       self.deck.shuffle()

       bet = 0
       bet = Bet()
       bet.betting(stash)


def main():
   print("\t\tWelcome to Blackjack!\n")
   stash = 0
   names = []
number = games.ask_number("How many players? (1 - 7): ", low = 1, high > .....

   game = BJ_Game(names)

File "I:/Python/programs/blackjackBetting.py", line 224, in <module>
   main()
 File "I:/Python/programs/blackjackBetting.py", line 216, in main
   game = BJ_Game(names)
File "I:/Python/programs/blackjackBetting.py", line 147, in __init__
   bet.betting(stash)
NameError: global name 'stash' is not defined

It says stash is not defined. That means there is no
variable named stash visible to Python inside the
init method of BJ_Game.

The only stash defined is in the main function.
variables defined inside a function (including main()
are *only* visible within that function, nowhere else.

But you have lots of missing names all over.
I suggest you review yuour code before trying
to run it, otherwise you will be seeing a lot of
these error messages.

You will fund information about naming and scope
in the "Whats in a name?" topic of my tutorial.

HTH,

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