while loop in python

Solutions on MaxInterview for while loop in python by the best coders in the world

showing results for - "while loop in python"
Till
11 Jan 2019
1int i = 0;
2
3while (i < 10)
4{
5    Console.WriteLine("Value of i: {0}", i);
6
7    i++;
8}
9
Coco
08 Jun 2018
1# Python does not have a do-while loop. You can however simulate
2# it by using a while loop over True and breaking when a certain
3# condition is met.
4# Example:
5i = 1
6while True:
7    print(i)
8    i = i + 1
9    if(i > 3):
10        break
Lenny
05 Apr 2017
1while True:
2  print("Running")
3  #<infinite>: "Running" untill you press "ctrl + c" in termenal
4  
Jonathan
20 Jul 2018
1j = 0
2while j < 3:
3  print("hello") # Or whatever you want
4  j += 1
5#This runs the loop until reaches 3 and above
Amandine
21 Jul 2016
1#Make a variable containing an integer like shown below:
2i=1
3while i<=6:
4  print ("Hello")
5#This loop will go on forever and the only way to stop it is to kill your program
Elisa
05 Jul 2020
1# while loop runs till the condition becomes false
2number = 0
3while number > 10:		# prints number till 10
4  print(number)
5  number += 1
6  
similar questions
queries leading to this page
while loop in python