Here’s the code:
The_Start = [1,1]
The_End = [1, 1]
for z in range(20):
for x in range(len(The_Start) - 1):
y = The_Start[x] + The_Start[x + 1]
The_End.insert[x + 1, y]
print The_End
The_Start = The_End
The_End = [1, 1]
This code is supposed to make a Pascal’s triangle. The error is on the sixth line.
You need to change the brackets in
The_End.insert[x + 1, y]to parenthesis.It’s good practice in Python to use lowercase variable names. Uppercase is generaly used for classes.