fork download
  1. def subsetOfNum(arr, n, sum = 0):
  2. res = [0]
  3. for i in range(0, n):
  4. for j in range(i+1, n):
  5. new_ele = res[i-1]+res[i]
  6. res.append(new_ele)
  7. print(res)
  8.  
  9.  
  10.  
  11.  
  12.  
  13. if __name__ == "__main__":
  14. arr = list(map(int, input().split()))
  15. n = len(arr)
  16. print(n)
  17. print(arr)
  18. subsetOfNum(arr, n)
  19.  
Success #stdin #stdout 0.06s 14144KB
stdin
2 3
stdout
2
[2, 3]
[0, 0]