+ 2

i am not getting the output of my pascals triangle code....check it out and plz tell me my mistake

https://code.sololearn.com/cCUxo0S52sWu/?ref=app

5th Jul 2019, 5:50 AM
AAYUSH PAGARE🇮🇳
AAYUSH PAGARE🇮🇳 - avatar
2 odpowiedzi
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
5th Jul 2019, 9:09 AM
Russ
Russ - avatar
+ 3
Your code works for me. Though it is erroneous, it is working.
5th Jul 2019, 8:44 AM
strawdog
strawdog - avatar