[Tutor] Blackjack Betting

Marc Tompkins marc.tompkins at gmail.com
Sun Jul 3 06:44:25 CEST 2011


On Sat, Jul 2, 2011 at 4:47 PM, David Merrick <merrickdav at gmail.com> wrote:

> Each player needs to be able to bet
>

Traceback (most recent call last):
>   File "I:/Python/Python Source Code/chapter09/blackjackBetting.py", line
> 204, in <module>
>     main()
>   File "I:/Python/Python Source Code/chapter09/blackjackBetting.py", line
> 196, in main
>     game = BJ_Game(names)
>   File "I:/Python/Python Source Code/chapter09/blackjackBetting.py", line
> 120, in __init__
>     bet = BJ_Player(name).betting(stash = 10)
> TypeError: betting() got multiple values for keyword argument 'stash'
> >>>
>
>

The "(stash = 10)" syntax is only used in the function (or method, in this
case) definition.  It means that "stash" is optional: if no value is
supplied for "stash", then it will be assigned a default value of 10.

So you have choices: all of the following will invoke "betting" with "stash"
having an initial value of 10.
    By value:

>         bet = BJ_Player(name).betting(10)
>
    By passing a variable:

>         pari = 10
>
        bet = BJ_Player(name).betting(pari)
>
    By default:

>         bet = BJ_Player(name).betting()
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110702/9b2eda34/attachment-0001.html>


More information about the Tutor mailing list