+ 1
Can anyone help to understand output of this code
i = 0 while 1==1: print(i) i = i + 1 if i <= 5: print("Breaking") break print ("Finhed")
1 Respuesta
+ 3
In this code condition for loop is 1==1 which is true. So conditions in loop will be executed. After printing i( which is 0) value of 1 will be increased to 1 as 0+1=1. As 1 is less than 5 if condition is true and block of if condition will be executed. After print statement there is a break command which will stop the loop execution and next executable statement will run i.e. print("Finhed")
Hope it is cleared