So I have been working on Pascal's triangle and going about it a different way then most. I am attempting do to a series of if and elif statements to check for the values in rows and columns of those rows. However my novice skills in python are stopping me from achieving my goal. Here is what I have so far:
h=input("Please enter the height: ") mytri=[ ] for row in range(0,h+1): newrow=[ ] if row==0: newrow= elif row==1: newrow=[1,1] else: for i in range(row): if i==row: newrow.append(1) elif i==row[-1]: newrow.append(1) else: a=(row-i)*(i-1) b=row-1 c=a+b newrow.append(c) mytri.append(newrow) print mytri
As you can probably tell from the code I do not quite know where my next step is. Like I said though my problem is trying to locate where a number is in a certain row and column. The only outcome I can seem to get is 1,10. If anyone has any insight into this madness I'll be ears open.