title: Pass a specific variable from a dict to a function (Python 3)
body: <p>Seriously learned so much from this site but now I have my own question!</p>
  
  <p>I am still pretty new but I am trying to take input from the user, find the input (as a hotkey) within the dict, and then use/pass that specific hotkey in the function that the dict redirects to. Hope that makes sense. Here is what I've tried so far:</p>
  
  <p>First I ask the user for a command:</p>
  
  <pre><code>command_input = input(prompt).lower()
      for i in all_commands:
          if command_input in all_commands[i]["hotkey"]:
              all_commands[i]["function"](hero)
              break
  </code></pre>
  
  <p>Then I'll lookup the input from the "hotkey" field in the dict:</p>
  
  <pre><code>all_commands = {
      1:  {"command_name" :   "north",
           "description"  :   "Travel north.",
           "hotkey"       :   "n",
           "function"     :   Character.navigate},
      2:  {"command_name" :   "east",
           "description"  :   "Travel east.",
           "hotkey"       :   "e",
           "function"     :   Character.navigate},
  }
  </code></pre>
  
  <p>So far so good. I can find the field, and call the associated function no problem. However, I want to just have one function, that specifically uses the "command_name" that was associated with that "hotkey". I could just have a specific function for each dict entry (e.g. Character.navigate_east vs navigate_north) but I don't want to have 4 different navigate functions. </p>
  
  <p>How do I pass the specific "command_name" to the following function? I do not want to have to require the command (some functions won't ask for it) but I want it if I need it. I will eventually need to parse out different things like "get object", etc and need to get different variables for different functions.</p>
  
  <pre><code>def navigate(self, **all_commands):
      direction = all_commands["command_name"]
  
      if direction in self.current_room["exits"]:
          self.current_room = rooms[self.current_room["exits"][direction]]
          Room.room_description(self)
      else:
          print (f"You can't go {direction}.")
  </code></pre>