Penguin Spaceman
Badges: 5
Rep:
?
#1
Report Thread starter 2 years ago
#1
I don't want it to come across as 'do my homework for me', but I'm currently really struggling with a question. It possibly could be due to the semantics of the question leading to my confusion because I'm not all that good at English, but nonetheless I'm having a bit of trouble with it and have no available help at the moment, apart from sites like TSR. It's a pretty short question by the looks of it.
Attached files
0
reply
Penguin Spaceman
Badges: 5
Rep:
?
#2
Report Thread starter 2 years ago
#2
(Original post by Penguin Spaceman)
I don't want it to come across as 'do my homework for me', but I'm currently really struggling with a question. It possibly could be due to the semantics of the question leading to my confusion because I'm not all that good at English, but nonetheless I'm having a bit of trouble with it and have no available help at the moment, apart from sites like TSR. It's a pretty short question by the looks of it.
Here's my attempt at a solution based on what i assume is being asked of me:
Attached files
0
reply
winterscoming
Badges: 19
Rep:
?
#3
Report 2 years ago
#3
It seems as if the question is simply asking you to construct and complete the "exits" dictionaries which are being used for each room.

A dictionary in python is a bit like a dictionary in the real world. A real-world dictionary is a huge collection of words, with a definition for each word. In the real world, a 'word' is like a key -- i.e. it's unique in the dictionary and only appears once. (OK, the real world is a bit more complicated because sometimes the same word will appear multiple times, but in Python it's simpler - each 'key' only appears once per dictionary, but you can have many dictionaries)

A python dictionary is the same - it's a list/collection of keys, where each key is paired with a "definition" (more commonly known as a 'value' ). So, in simplistic terms, a dictionary is just a list/collection of pairs of Keys and Values. (sometimes known as key-value pairs)

e.g. a Python dictionary which might mimic a real-world dictionary:
Code:
myDictionary = [
  { "Apple" : "A rounded red or green fruit which grows on a tree" },
  { "Banana": "A long curved yellow fruit which grows in clusters" },
  { "Strawberry": "A sweet soft red fruit with a seed-studded surface" },
]
Dictionaries are used for creating assocations - in other words, for creating lists of 'pairs' which are joined together - e.g. joining a bunch of words to each of their respective definitions.

It seems like your assignment is asking you to look at each individual room (on the map) and create a separate dictionary for each room. Each room's dictionary to contain associations between the names of that room's exits (which look like compass directions), and the rooms those exits are joined to. (reception, tutor, parking, etc.) - so it's asking you to build those pairs for each room.

Presumably there's some other logic in that Python program which uses the associations in that dictionary in order to be able to know how about all the rooms and how they join to each other.

If you want to try things out to make sure you get the syntax correct, try using this online Python editor:
http://repl.it/languages/python3

There's a few examples of dictionaries and their syntax/use here:
https://www.w3schools.com/python/pyt...ctionaries.asp

Also, you can put a dictionary inside an object as per the assignment you're already working on:
Code:
myLittleObject = {
  "myVariable": 42,

  "myDictionary": [
    { "key1": "value1" },
    { "key2": "value2" },
    { "key3": "value3" }
  ]
}
1
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

If you haven't confirmed your firm and insurance choices yet, why is that?

I don't want to decide until I've received all my offers (7)
53.85%
I am waiting until the deadline in case anything in my life changes (2)
15.38%
I am waiting until the deadline in case something in the world changes (ie. pandemic-related) (1)
7.69%
I am waiting until I can see the unis in person (0)
0%
I still have more questions before I made my decision (2)
15.38%
No reason, just haven't entered it yet (0)
0%
Something else (let us know in the thread!) (1)
7.69%

Watched Threads

View All