Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8527717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:38:05+00:00 2026-06-11T08:38:05+00:00

I am doing exercise 47 of Learn Python the hard way, and I am

  • 0

I am doing exercise 47 of Learn Python the hard way, and I am getting an error saying:

Traceback (most recent call last):
File "c:\python26\lib\site-packages\nose-1.2.0-py2.6.egg\nose
97, in runTest
self.test(*self.arg)
File "E:\project\ex47\tests\ex47_tests.py", line 27, in test_
assert_equal(start.go('down').go('up'),start)
AssertionError: None != <ex47.game.Room object at 0x0191BFD0>

#while executing the below code: 

from nose.tools import *
from ex47.game import Room

def test_room():
    gold=Room("GoldRoom",
                """This room has gold in it you can grab. There's a
                door to the north.""")
    assert_equal(gold.name,"GoldRoom")
    assert_equal(gold.paths,{})

def test_room_paths():
    center = Room("Center","Test room in the center.")
    north = Room("North","Test room in the north.")
    south = Room("South", "Test room in the south.")
    center.add_paths({'north':north,'south': south})
    assert_equal(center.go('north'),north)
    assert_equal(center.go('south'),south)

def test_map():
    start = Room("start", "You can go west and down a hole.")
    west = Room("Trees","There are trees here, you can go east.")
    down = Room("Dungeon","It's dark down here, you can go up.")
    start.add_paths({'west':west,'down':down})
    west.add_paths({'east':start})
    assert_equal(start.go('west'),west)
    assert_equal(start.go('west').go('east'),start)
    assert_equal(start.go('down').go('up'),start)

I searched on Google and found out that it is raised while we are debugging but could it also be caused how my game.py file is located inside the bin folder

the overall structure is like this

Projects/ex47/bins/
                              /docs
                               /tests/ex47_tests.py, _ _ init_ _ .py
                              /ex47/game.py

Can anyone please help me out and tell me why I am getting this error?

this is the game.py file.

class Room(object):
    def __init__(self,name,description):
        self.name = name
        self.description = description
        self.paths={}


    def go(self,direction):
        return self.paths.get(direction,None)

    def add_paths(self,paths):
        self.paths.update(paths)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:38:07+00:00Added an answer on June 11, 2026 at 8:38 am

    You’ve never added an up path to your down room.

    down = Room("Dungeon","It's dark down here, you can go up.")
    

    So your failure is on this line

    assert_equal(start.go('down').go('up'),start)
    

    start.go('down') returns the down Room object, which has no path for up. It returns None from your get() call, and compares again the start object. The assertion is raised because None != start

    Looks like you need this line:

    down.add_paths({'up', start})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing exercise 26 in learn python the hard way and have been
I'm up to Exercise 41 in Learn Python the Hard Way, and I'm having
I am on exercise 43 doing some self-directed work in Learn Python The Hard
I am trying to complete Exercise 47 of Learn Python The Hard Way, 2nd
I'm doing Zed Shaw's Learn C The Hard Way course. On exercise 11, in
I'm learning Python using Learn Python The Hard Way . It is very good
I'm using learn python the hard way 2nd edition to teach myself programming. In
Zed Shaw's Learn Python the Hard Way frequently asks you to write out in
I'm doing exercise #9 from http://openbookproject.net/thinkcs/python/english2e/ch09.html and have ran into something that doesn't make
I'm doing an exercise where I store coordinates into a .txt file called mydata,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.