Based on your room layout in your comment, your code, and my ability to speak Dutch, it looks like you want to get all values that are not "naam" or "note" and then fetch the names from "kamers" based on these IDs.
I would restructure the layout to make things less complicated. I recommend a layout like this:
kamers = {
1: { "naam": "de Lobby", "adjacent": [2, 3] }, ...
}
Now you can just use the
adjacent
value to figure out what rooms you can go to.
You can do that like this:
[kamers[i]['naam'] for i in kamers[currentKamer]['adjacent']]
for i in kamers[currentKamer]['adjacent']
iterates over each integer in the 'adjacent' list of the value in "kamers" with 'currentKamer' as key. Then
kamers[i]['naam']
selects the name for the room with key
i
.