Create a vector given N input of names and ages python
<p>I need to create a program that takes as inputs multiple entries of names and ages. Then I want it to return the names and ages of those entries that have higher age values than the average age of all entries.
For example:</p>

<pre><code>input( "Enter a name: ") Albert   
input( "Enter an age: ") 16

input( "Enter a name: ") Robert   
input( "Enter an age: ") 18

input( "Enter a name: ") Rose  
input( "Enter an age: ") 20

The average is = 18
Rose at 20 is higher than the average. 
</code></pre>

<p>How can I do this?</p>

<pre><code>answers = {} 
# Use a flag to indicate that the questionnaire is active. 
questions_active = True 
while questions_active: 
# Ask for the person's name and response.
    name = raw_input("\nEnter a name: ") 
    response = raw_input("Enter an age: ")
# Store the response in the dictionary: 
    answers[name] = int(response)
# Check if anyone else is going to take the questionnaire. 
    repeat = raw_input("Would you like to let another person respond? (yes/ no) ") 
    if repeat == 'no': 
        questions_active = False

average_age = sum(answers.values())/float(len(answers))
print("The average is " + str(average_age))
# Questionnaire is complete. Show the results. 
for name, response in answers.items():
    if response &gt; average_age:
        print(name.title() + " at " + str(response) + " is higher than the average.")
</code></pre>

<p>This answer is based on a similar example from the book "Python Crash Course: A Hands-On, Project-Based Introduction to Programming" <a href="https://www.nostarch.com/pythoncrashcourse" rel="nofollow">https://www.nostarch.com/pythoncrashcourse</a></p>

python dictionary vector