Printing Triangle using While Loop in Python programming. While Loop allows code to be executed and repeat a specific block of code until the boolean condition is met.
a = 0
while a <= 10: #loop looping from 0 to 10.
if a == 5: #if 'a' value equal to 5 then
print("The Statement is Break on 5")
break #break the process.
print(a)
a = a + 1
a = 0
while a <= 10: #loop looping from 0 to 10.
b = 0
while b <= a: #loop looping from 0 to 'a' value.
print("* ", end="") #and printing '*',
b += 1 #adding 1 to 'b' value.
print() #used for New Line.
a += 1 #adding 1 to 'a' value.