0

Need an answer.

What is an output of this code? for i in [‘+’,’-‘]: print(i) break The output is given as: + Can any one reply how this happen?

29th Jan 2018, 6:08 PM
Amith Varma
Amith Varma - avatar
3 odpowiedzi
+ 2
you print the first char '+', then you break the loop, that means program cotinues after the loop and it ends, because nothing is after the loop
29th Jan 2018, 6:13 PM
michal
+ 2
yes
29th Jan 2018, 6:15 PM
michal
+ 1
Ok if break statement is not present the next character ‘-‘ also prints right?
29th Jan 2018, 6:14 PM
Amith Varma
Amith Varma - avatar