mmishanchyk

Retake Exam - 16 December 2020 (problem3)

Jun 21st, 2021
1,771
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def get_magic_triangle(n, x=None):
  2.     if x is None:
  3.         x = [[1], [1, 1]]
  4.     if n == 2:
  5.         print(x)
  6.     else:
  7.         y = []
  8.         y.append(x[-1][0])
  9.         for el in range(1, len(x[-1])):
  10.             y.append(int(x[-1][el-1]) + int(x[-1][el]))
  11.         y.append(x[-1][len(x[-1])-1])
  12.         x.append(y)
  13.         get_magic_triangle(n-1, x=x)
  14.  
  15.     return x
RAW Paste Data