+ 2
i am not getting the output of my pascals triangle code....check it out and plz tell me my mistake
2 Réponses
0
You had an extra loop which you didn't need.
#JUST ENTER THE NO OF ROWS
rows=int(input("rows"))
i=0
while i<rows :
c=1
k=0
j=0 #moved initialisation of j here.
'''while k<rows-i :
print(" ")
k=k+1
j=0''' #this loop was not needed
while j<=i:
print(c,end="")
c=int(c*(i-j)//(j+1))
j=j+1
#print("",end="") #this doesn't even do anything
i=i+1 #moved i increment to here
print("") #to create newline
+ 3
Your code works for me. Though it is erroneous, it is working.