ways = []
amount = 4
    
def count_change(change, way):
    global ways
 
    for i in range(len(change)):
        way_new = way + [change[i]]
        if sum(way_new) < amount:
            count_change(change[i:], way_new)
        elif sum(way_new) == amount:
            print(way_new)
            ways.append(way_new)
    
if __name__ == "__main__":
    count_change([2, 1], [])
    print(amount, "can be changed in ", str(len(ways)) +  " ways" )




2279a901451487517a0d981d22c4bb2ce8c0848f
<mask token>

<mask token>


def count_change(change, way):
    global ways
    for i in range(len(change)):
        way_new = way + [change[i]]
        if sum(way_new) < amount:
            count_change(change[i:], way_new)
        elif sum(way_new) == amount:
            print(way_new)
            ways.append(way_new)


<mask token>

<mask token>


def count_change(change, way):
    global ways
    for i in range(len(change)):
        way_new = way + [change[i]]
        if sum(way_new) < amount:
            count_change(change[i:], way_new)
        elif sum(way_new) == amount:
            print(way_new)
            ways.append(way_new)


if __name__ == '__main__':
    count_change([2, 1], [])
    print(amount, 'can be changed in ', str(len(ways)) + ' ways')

ways = []
amount = 4


def count_change(change, way):
    global ways
    for i in range(len(change)):
        way_new = way + [change[i]]
        if sum(way_new) < amount:
            count_change(change[i:], way_new)
        elif sum(way_new) == amount:
            print(way_new)
            ways.append(way_new)


if __name__ == '__main__':
    count_change([2, 1], [])
    print(amount, 'can be changed in ', str(len(ways)) + ' ways')

ways = []
amount = 4
    
def count_change(change, way):
    global ways
 
    for i in range(len(change)):
        way_new = way + [change[i]]
        if sum(way_new) < amount:
            count_change(change[i:], way_new)
        elif sum(way_new) == amount:
            print(way_new)
            ways.append(way_new)
    
if __name__ == "__main__":
    count_change([2, 1], [])
    print(amount, "can be changed in ", str(len(ways)) +  " ways" )



