+ 1
Output?
What is the output of this code? for ch in “happy”: print(ch) break Output given: h Can anyone help me with this?
4 Antworten
+ 1
at first iteration you take the first character 'h' and you print it. then you break the loop so iterations with other char are skipped, then program ends and just h was printed
+ 1
Why can’t the entire happy prints? Only the h first?
+ 1
because you have that break there, it cancels the loop after first getting there
delete it
+ 1
Ok thank you. I forgot that. Thanks alot for this😀