[Solved] Python raw_input to extract from dictionary


Solution

while True:
    prompt = int(raw_input(" Enter ID of person you would like to search for: "))

    if prompt > 100:
        print("Please try again")
        continue 
    elif prompt < 1: 
        displayPerson(prompt,persons)
    else:
        break

print("Terminated.")

Explanation

You enter the loop and get an ID from the user.

If prompt > 0: display the person
Otherwise, break out of the loop and print “Terminated”.

2

solved Python raw_input to extract from dictionary