First of all, do you know why this code doesn't work at all? When I give it the input 'when was steve jobs born' it returns nothing. Secondly I'm almost certain this can be written in a more efficent way which would take less time for the program to execute. Any ideas? Thanks!
import sys
Bill_Gates = ["bill gates","1955", "Co-founder of Microsoft"]
Steve_Jobs = ["steve jobs","1955", "Co-Founder of Apple"]
Albert_Einstein = ["albert einstein","1879", "Phycisist"]
PEOPLE = [Bill_Gates, Steve_Jobs, Albert_Einstein]
userInput = input("say something")
#checking if userInput contains the peoples name
if userInput in [j for i in PEOPLE for j in i]:
for i in range(len(PEOPLE)):
if PEOPLE [i][0] in userInput:
if "when was" in userInput:
if "born" in userInput:
print(PEOPLE[i][0] + "was born in " + PEOPLE[i][1])
UPDATE: Ahsanul Haque gave me just the answer I was searching for.