0
Loops
while 1==1 print ('python') someone explain me this code in briefly.
5 Answers
+ 7
It will keep printing python because the statement in while is true.
+ 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
+ 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).
0
in detail
0
thnx bro