0

Loops

while 1==1 print ('python') someone explain me this code in briefly.

12th Jan 2017, 5:39 AM
nikhil patel
nikhil patel - avatar
5 Respostas
+ 7
It will keep printing python because the statement in while is true.
12th Jan 2017, 5:42 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 5
The while keyword starts a loop condition with a test of true/false. Since the condition stated 1==1 will always be true the loop will never exit. i.e While means do the following code while this condition is true... while [condition to be tested] code to run \ repeat in loop
12th Jan 2017, 5:54 AM
jay
jay - avatar
+ 4
A while loop exists to repeat a block of code until it's true. In the example, the condition 1 == 1 will always be true, making it equal to writing: while True: print("python") You should never write an infinite loop outside of test codes, and should instead write conditions that can be false, or the program will get stuck (as you would expect it to).
12th Jan 2017, 6:22 AM
Dao
Dao - avatar
0
in detail
12th Jan 2017, 5:43 AM
nikhil patel
nikhil patel - avatar
0
thnx bro
12th Jan 2017, 5:55 AM
nikhil patel
nikhil patel - avatar