Number of triangles after N moves | function to calculate number of triangles in Nth step ; Driver code
def numberOfTriangles ( n ) : NEW_LINE INDENT ans = 2 * ( pow ( 3 , n ) ) - 1 ; NEW_LINE return ans ; NEW_LINE DEDENT n = 2 NEW_LINE print ( numberOfTriangles ( n ) ) NEW_LINE