title: Retrieving a list of Dictionaries from Nested Dictionary with an Input from User
body: <p>I'm a bit new to Python and I'm working with Python 3. What I want to do is to retrieve a list of dictionaries, from the nested dictionary, with a similar key to what the user will input.</p>
  <p>Here's what I'm doing</p>
  <pre><code>import pickle
  import os
  os.system(&quot;cls&quot;)
  
  p_inputs = {
   'DOE, JOHN': {'SEX': 'MALE', 'AGE': 18},
   'DOE, JANE': {'SEX': 'FEMALE', 'AGE': 18},
   'WEST, MARIA': {'SEX': 'FEMALE', 'AGE': 18}}
  
  print(&quot;Please enter the necessary information.&quot;)
  new_name = input(&quot;\nFULL NAME, SURNAME FIRST: &quot;).upper()
  new_sex =  input(&quot;SEX: &quot;).upper()
  new_age = int(input(&quot;AGE: &quot;))
  
  p_inputs[new_name] = {'SEX': new_sex, 'AGE': new_age,}
  pickle.dump(p_inputs, open(&quot;info&quot;, &quot;wb&quot;))
  </code></pre>
  <p>Now, what should I do when I insert a line where I ask for the user's input, for example, I'm asking for the age. Then the user will type &quot;18&quot;, how do I get a list of all the dictionaries of people with the AGE of 18?</p>
  <p>I apologize if I got something wrong.</p>