0
Python provides an inbuilt function 'print' which h automatically generates a line break when it is called, then how can we generate a pattern as : 1 2 2 3 3 3 4 4 4 4 and so on.. using while loop ???
2 Antworten
+ 2
i=1
j=1
while i<=4:
j=1
while j<=i:
print(j, end=" ")
j+=1 #End of body of 2nd while loop
#print("\n") #in the body of 1st while loop
i+=1
0
i = 1
n = 7
while i < n:
print(str(i) * i)
i += 1