On 14 Mar 2015 12:22, "John" <john-dja...@martinhome.org.uk> 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 an instance of Hand before calling
the ask_number method.

Your code might then be something like:
nr_players=Hand()
nr_players.ask_number("Ilu graczy ma wziąść udział w grze
(2-5):",low=2,high=5)

> John
>
>
>
> On 14/03/15 08:30, Dariusz Mysior wrote:
>>
>> 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 <module>
>>>     nr_players=Hand.ask_number("Ilu graczy ma wziąść udział w grze
(2-5):",low=2,high=5)
>>> TypeError: ask_number() takes exactly 4 non-keyword positional
arguments (1 given)
>>
>>
>> my code
>>
>>
>> class Hand(object):
>>     def ask_number(self,question,low,high):
>>         response=None
>>         while response not in range(low,high):
>>             response=int(input(question))
>>         return response
>>     def ask_human_players(self,question,nr_player):
>>         response=None
>>         while response not in range(low,nr_player):
>>             response=int(input(question))
>>         return response
>>
>> nr_players=Hand.ask_number("Ilu graczy ma wziąść udział w grze
(2-5):",low=2,high=5)
>> print(nr_players)
>>
>> human_players=Hand.ask_human_players("Ile graczy to ludzie",nr_players)
>> print(human_players)
>>
>> --
>> You received this message because you are subscribed to the Google
Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/b825f565-98fb-4bf3-a136-58dfcb424dc5%40googlegroups.com
.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/550419D5.1060503%40martinhome.org.uk
.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BWjgXMA4j_wPZLAaWtf-H1c2nyWGNFcemLW4xXLZ0%2B%3DamvNrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to