Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

algebraic pyramid python


def calcul_pyramid(base):
    pyramid = [base]
    for i in range(len(base) - 1):
        actual_layer = []
        last_layer = pyramid[i]
        for j in range(len(last_layer) - 1):
            actual_layer.append(last_layer[j] + last_layer[j + 1])
        pyramid.append(actual_layer)
    return pyramid

Source by w3programmers.org #
 
PREVIOUS NEXT
Tagged: #algebraic #pyramid #python
ADD COMMENT
Topic
Name
8+4 =