[Tutor] role playing game - help needed
Al Stern
albstern at gmail.com
Tue Dec 7 16:35:40 CET 2010
Apologies for all my questions. Up to this point I have been able to work
out most of the challenges but I seem to have hit a wall. Can't seem to
make any progress and completely frustrated.
I looked at the 11/21 discussion. From the documentation, I realized I
needed to set the variables to view the keys and values. Getting an error
though.
attributes = {"strength": 0, "health": 0, "wisdom": 0, "dexterity": 0}
MAX_POINTS = 30
keys = attributes.viewkeys()
values = attributes.viewvalues()
Traceback (most recent call last):
File "C:\Users\Public\Documents\My Python programs\role_playing_game1.py",
line 8, in <module>
keys = attributes.viewkeys()
AttributeError: 'dict' object has no attribute 'viewkeys'
On Tue, Dec 7, 2010 at 3:44 AM, Alan Gauld <alan.gauld at btinternet.com>wrote:
>
> "Al Stern" <albstern at gmail.com> wrote
>
> attributes = {"strength": 0, "health": 0, "wisdom": 0, "dexterity": 0}
>> MAX_POINTS = 30
>>
>> How do I set the variable for available_points?
>>
>> available_points = MAX_POINTS - (not sure what goes here)
>>
>
> Check the mail from Robert Sjoblom, he gives you the necessary clues.
> You can check the archive a few weeks back(21st Nov) for his question
> too and get some alternative options and discussion.
>
>
> attributes["strength"] = input("\nHow many points do you want to assign to
>> strength?: ")
>>
>> Please let me know if this isn't advisable. It seems to work on the
>> surface.
>>
>
> Close, but remember that input() returns a string. You need numbers
> so you need to convert strings to integers.
>
>
> HTH,
>
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101207/451846a0/attachment.html>
More information about the Tutor
mailing list