Answers for "while else python"

2

while else python

target = 100
current = 0

while current != target: 
  current += 1
  print(current)
  
#The while loop repeats the indented code while its condition is true
#(current IS NOT equal to target).
  
else:
  print("Target Reached!")
  
#When the while loop condition is no longer true (current IS equal to target),
#the indented code under else: is ran.
Posted by: Guest on September-01-2020
5

while loop in python

#there are 2 ways to make a while loop in python

#first way -

while True:
  (#what ever you want in the loop)
    
#second way - 
    
while 1:  
    (#what ever you want in the loop)
Posted by: Guest on July-22-2020
3

python while loop

while <Condition>:
  <code>
  
  #example
  i = 10
  while i == 10:
    print("Hello World!")
Posted by: Guest on August-04-2020

Python Answers by Framework

Browse Popular Code Answers by Language