Python Program To Print Numbers Before A Number.

In this program, we will print the numbers before a number.

Steps to solve the program
  1. Create a variable and assign its value equal to 1.
  2. While the value of the variable is less than 11 print the number.
  3. Add 1 to the variable.
  4. If the value of the variable is equal to 6 break the loop.
				
					#81
count = 1

while count < 11:
    print(count)
    count += 1
    if count == 6:
        break
				
			

Output :

				
					1
2
3
4
5
				
			

print the last element of a list using a while loop

print 1-10 natural numbers but it should stop when the number is 6

Leave a Comment