samedi 2 mai 2015

how to pass function through previous function? python

The goal of this program is to test and see if there is three or more blues/'b'. How would I go about doing this? Any help always appreciated, thanks.

def manufactoria():

    test(three_or_more_blues, "brrrrrbrrrrrb")

def test(fn, string):

    if fn(string):
        result = "accepted"
    else:
        result = "not accepted"

    print('The string "' + string + '" is ' + result)

manufactoria()

Aucun commentaire:

Enregistrer un commentaire