0
i = 0 while 1==1: print(i) i = i + 1 if i >= 5: print("Breaking") print("Finished") break
why break is not working in last. even this 'break' is inside my while loop. comment/guide me with easy methods and using easy English words. thank you https://code.sololearn.com/cQ80u4LENN32/?ref=app
6 Respuestas
+ 5
Like Jamie said, it needs to be indented. Python uses indentations and whitespace whereas many programs ignore it but require more code.
When you run your code it mentions it expects indentation.
+ 4
@Pranit Bhoir the if statement will break the loop (after i==5) once it's indented so it won't be infinite.
0
can you please elaborate
0
@pranit bhoir . if I want to perform 4 tasks after any condition is true then? should I write same condition 4 times? please ans logically dude. don't throw random wrong information.
0
thank you @jamie . I am Rohit bdw 😃
0
please explain me : while 1==1:
meaning of it in details