+ 3

Give me a simple program using while loop

16th Nov 2017, 5:40 PM
AkshĂ€Ăœ LÚö
AkshĂ€Ăœ LÚö - avatar
3 Answers
+ 5
# mini lesson... ############################ condition1 = True while condition1: #if condition is True => your function will execute, while condition is True, else: it stops function() #<= your function while not condition: #this loop use method 'not', so condition is not True => condition1 = False, so your function will not execute, while False, else: it starts function() #<= your function ########################### my code: https://code.sololearn.com/c83mzTtIQgX3/?ref=app it prints all chars while condition is True, but if integer 'char' == 9000 => its stops! (break method)
16th Nov 2017, 5:52 PM
PythonException
PythonException - avatar
+ 3
https://code.sololearn.com/cUHocWi3FWcl/#py #EXAMPLE 1 loopCond = True; while loopCond: print("All your loop are belong to us!") loopCond = False #EXAMPLE 2 loopCond = True while loopCond: print("All your loop still belong to us!") break #EXAMPLE 3 while True: print("All your loop still belonging to us!") break
16th Nov 2017, 5:44 PM
AgentSmith
+ 1
Example: To print the numbers 1 through 10 i = 1 while i<=10: print (i) i = i + 1
21st Nov 2017, 3:34 PM
Brittany Meadows
Brittany Meadows - avatar