This is what you are looking for - dict(recordslist). A dictionary in Python is a key value pair. Your data can be better structured as a key value pair. Key being the name of the person and value being his/her corresponding score. dict(recordslist) converts your data from a list of lists to a dictionary.
You can access the value corresponding to a key in a dictionary as:
dictionary_variable[key]
Demo:
>>> recordslist = [["Daniel", 18], ["John", 19], ["Paul", 20], ["Jack", 44]]
>>> a_dict = dict(recordslist)
>>> a_dict
{'John': 19, 'Paul': 20, 'Daniel': 18, 'Jack': 44}
>>> a_dict['Daniel']
18
In your code you would do:
def checkAge(name, a_dict):
if name in a_dict:
return a_dict[name]
else:
return "No score found for {}".format(name)
result = checkAge(str(input("What is your name?")))
print result
Note: In order for this to work as you expect it to, you must have unique names in your list of list. This is what I mean:
>>> recordslist = [["Daniel", 18], ["John", 19], ["Paul", 20], ["Jack", 44], ["Daniel", 40]]
>>> a_dict = dict(recordslist)
>>> a_dict
{'John': 19, 'Paul': 20, 'Daniel': 40, 'Jack': 44}
I added ["Daniel", 40] to your recordslist and the a_dict has only one entry for Daniel.
dictinstead of alistoflists, like:records = {"Daniel":18, "John":19"}then dorecords[name]