[Tutor] Hands-on beginner's project?

nathan virgil sdragon1984 at gmail.com
Fri Oct 3 14:46:08 CEST 2008


Hm... Tried changing that, but it didn't help....

On Thu, Oct 2, 2008 at 9:18 AM, Luke Paireepinart <rabidpoobear at gmail.com>wrote:

> room == start is a comparison (check if room is equal to start - doesn't
> make a whole lot of sense to be doing that here).  The "room" variable name
> doesn't exist in the current namespace, so it can't be compared to start.
> It looks like you wanted room = start.
>
> On 10/2/08, nathan virgil <sdragon1984 at gmail.com> wrote:
>
>> Okay, I'm resurrecting this project. I did a little more work on it then
>> what you see here, but that ended up getting accidentally deleted, and I
>> haven't done anything with Python since.
>>
>> I'm running into one problem already, and I haven't really added any extra
>> code. In the content (at this point, the rooms still have Bob's
>> descriptions), the very first line of actual code (third line in the
>> program) is returning an error.
>>
>> Offending code:
>>
>> # Content
>> # retrieve data for current room
>> room == start
>> while true:
>>     if room == start:
>>         desc = "Ahead of you, you see a chasm."
>>         ques = "Do you wish to try jumping over it? Y/N"
>>         destY = 2
>>         destN = 3
>>
>> Error:
>>
>> Traceback (most recent call last):
>>   File "samplegame.py", line 3, in <module>
>>     room == start
>> NameError: name 'room' is not defined
>>
>>
>> What's going on here?
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081003/b627a5f1/attachment.htm>


More information about the Tutor mailing list