Loops | SoloLearn: Learn to code for FREE!



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

1/12/2017 5:39:14 AM

nikhil patel

5 Answers

New Answer


It will keep printing python because the statement in while is true.


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


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).


in detail


thnx bro