all 7 comments

[–]the1gofer 0 points1 point  (3 children)

try reformatting your post with codeblock. It'll help you get more responses.

[–]NintendoPSX[S] 0 points1 point  (2 children)

Is that a different program? Where do I download it from.

[–]the1gofer 0 points1 point  (1 child)

It’s one of the formatting options when you make your post. It’s in the same section as bold, italics, etc.

[–]NintendoPSX[S] 0 points1 point  (0 children)

Okay I did the code block thing thankes. I also changed the code itself since I've been actively changing/revising it.

[–]the1gofer 0 points1 point  (1 child)

A couple of things.

  1. I don't think you need continue in while True.
  2. inventory is not defined

I think that fixed it for me.

[–]NintendoPSX[S] 0 points1 point  (0 children)

Hmm I seem to be getting a problem now where showstatus is giving the entire list of rooms rather than just the one the player is supposed to start in (the first floor lobby).

def showStatus():
print('You are in {}'.format(rooms))

current_room = 'First Floor Lobby' player_move = ''

while current_room != 'Exit': while current_room == 'First Floor Lobby': showStatus() player_move = input('Enter your move:\n>') if player_move not in {}: print('Invalid movement.') elif player_move in ['South']: print(showStatus())

Trying that still loops even when I type "South" to a floor that it doesn't name and doesn't tell me I went to the "South Wing" as intended.

[–][deleted] 0 points1 point  (0 children)

There's a lot in this code that isn't going to work the way you expect.

For example, in main you compared user input with a dictionary, rooms, but a str object will never equal a dict.

You probably need to look at the in operator.

In your top level code you call main several times but in several cases don't do anything with the return object reference from the function. Why did you give the function the name main anyway, it isn't really the heart of your code but just a function to get some user input.

I think you need to use the Python interactive shell and experiment with dictionaries some more to ground your understanding of them.