Python code:
arr = [['name1', 101], ['name2', 234], ['name3', 456]]
nametolookfor = input("Please enter the name: ")
data = 0
for value in arr:
if value[0] == nametolookfor:
otherdata = value[1]
I was wondering if the for loop and its contents could be brought down to one line.
I have tried using list comprehensions but can't seem to get it to work.