My program begins with a list of names. eg: ['Bob','John','Mike']' This list is then shuffled into a random order. eg: ['Mike','Bob','John'] A name then gets taken from the list. eg: ['Mike'] leaving ['Bob','John']
I would then like to associate this name with a dictionary of the same name. eg: 'Mike' = {'Surname' : 'Jones', 'Age': 55, 'Staff ID': 101}
Then be able to call and print a particular Key : Value of the chosen name. eg: print(Mike[Age])
(my code at present is similar to this example)
list_of_names = ['Bob','John','Mary','Joan','Mike']
chosen_name = list_of_names.pop(0)
print("person chosen: ", (chosen_name))
# Dictionaries are pre-formatted waiting to be paired with their listed name
'Bob' = {'Surname' : 'Kelly', 'Age': 49, 'Staff ID': 86},
'John' = {'Surname' : 'Hogan', 'Age': 57, 'Staff ID': 22},
'Mike' = {'Surname' : 'Jones', 'Age': 55, 'Staff ID': 101},
# Prints the randomly chosen name and the dictionary associated with it.
print(chosen_name)
# Prints a Value for a particular key of that chosen name
print(chosen_name[Age])
I would greatly appreciate any advice or even alternative methods of achieving this. Many thanks.