I'm supposed to make a function with a list and a title as a string, and then return the item from the list, based on the title.
def find_appointment(lst, title = ""):
if title in lst:
funn = lst.find(title)
return funn
else:
print("No result")
appointments = ["Zoo: 11.03.22", "Shopping: 13.08.22", "Christmas: 24.12.22", "Funeral: 25.12.22"]
find_appointment(appointments, "Zoo")
I hoped to get "Zoo: 11.03.22", but instead got "No result"
The list here is just a random one I made up. In the actual list I won't know the positions of the items.