0

The problem is the following: Write a program that writes on the screen 1 to 100, 1 in 1, 3 times. The first time should use for and the second while and the third do while,how to emulate the do while statement. Follow the code as far as I did:

i = 0
n = 0
for n in range(100):
 print(n - 1)
 while i < 100:
  print(i)
  i = i + 1

1 Answers1

3

Python doesn't have a do while loop, u can simulate it like this

i = 1  

while True:  
    print(i)  
    i = i + 1  
    if(i > 100):  
        break  
Surya Tej
  • 1,342
  • 2
  • 15
  • 25