PYTHON algorithm question: Categorize New Member

The Western Suburbs Croquet Club has two categories of membership, Senior and Open. They would like your help with an application form that will tell prospective members which category they will be placed.

To be a senior, a member must be at least 55 years old and have a handicap greater than 7. In this croquet club, handicaps range from -2 to +26; the better the player the lower the handicap.

test.assert_equals(openOrSenior([[45, 12],[55,21],[19, -2],[104, 20]]),['Open', 'Senior', 'Open', 'Senior'])
test.assert_equals(openOrSenior([[16, 23],[73,1],[56, 20],[1, -1]]),['Open', 'Open', 'Senior', 'Open'])

The idea of ​​this question is relatively simple:

def openOrSenior(data):
    l=[]
    for i in data:
        if i[0]>=55 and i[1]>7:
            l.append('senior')
        else:
            l.append('open')
    return l






Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325481159&siteId=291194637