On 14 Mar 2015 12:22, "John" wrote:
>
>
> Dariusz,
>
> You've declared ask_number() as an instance method in class Hand. You are
calling it as if it was a class method. See
https://docs.python.org/3.1/tutorial/classes.html.
>
In other words, you have to first create
Change your method:
def ask_number(self,question,low,high):
response=None
while response not in range(low,high):
response=int(input(question))
change self to class:
This way you can call the method directly from Hand.
@classmethod
def
Dariusz,
You've declared ask_number() as an instance method in class Hand. You
are calling it as if it was a class method. See
https://docs.python.org/3.1/tutorial/classes.html.
John
On 14/03/15 08:30, Dariusz Mysior wrote:
> Mam jeden problem nie wiem dlaczego mam bład
> I have problem with
Mam jeden problem nie wiem dlaczego mam bład
I have problem with this bug :/
Traceback (most recent call last):
> File "C:\Python31\makao.py", line 23, in
> nr_players=Hand.ask_number("Ilu graczy ma wziąść udział w grze
> (2-5):",low=2,high=5)
> TypeError: ask_number() takes exactly 4
4 matches
Mail list logo