Python Forum

Full Version: Recursive function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to change this code to recursive code...

def search(myList, number):
    for i in myList:
        if i[0] == number:
            return i[1]
    return None



myList = [(5107261, 'Ernst'), (6524256, 'Arvo')]

number = 5107261

print(search(myList, number))
We're not going to do your homework for you, what have you tried? Have you identified the basis and recursive cases?