Answers for "when to use while loop and for loop in python"

5

while loop in python

j = 0
while j < 3:
  print("hello") # Or whatever you want
  j += 1
#This runs the loop until reaches 3 and above
Posted by: Guest on November-26-2020
0

while loop in python

# while loop runs till the condition becomes false
number = 0
while number > 10:		# prints number till 10
  print(number)
  number += 1
Posted by: Guest on December-31-2020

Code answers related to "when to use while loop and for loop in python"

Python Answers by Framework

Browse Popular Code Answers by Language