+ 1
in python no brace so how do we distinguish the end of the while loop?
5 Respuestas
+ 2
by the concept od indentation
every line in the loop must be indented and the lines outside the loop won't be indented
for ex
x=5
y=8
while x<y
d=x/y
g=x*y
f=x%y
print('i am outside the loop')
+ 1
Statements/commands that are controlled by a while, if, for must have same indentation. The break is used to exit the loop on any point inside the loop, but it is not required in order to end the loop, it depends on your logic.
0
You must indentation.
0
thanks but..in simple calculator example..one big indentation but break statement is used thereafter
0
thanks