def pascaltriangle(row): tvar = [1] for i in range(1,row): temp = [1] for n in range(0, i-1): temp.append(tvar[i-1][n]+tvar[i-1][n+1]) temp.append(1) tvar.append(temp) return tvar def print_triangle(): for i in pascaltriangle(int(input("Please enter the height of the triangle:\n"))): print("The triangle is:\n",i) print_triangle() Please enter the height of the triangle: 4 The triangle is: 1 The triangle is: [1, 1] The triangle is: [1, 2, 1] The triangle is: [1, 3, 3, 1] Can anyone help me?
Java?
its python, but question asker doesnt say what help is needed
Sorry, i need to print the triangle without the brackets and without the "The triangle is:" so basically the output must look like: 1 121 1331
Join our real-time social learning platform and learn together with your friends!