0
Can someone help me to explain the answer for this code?
count = 0 for letter in 'Snow!': print('Letter # ' + str(count) + ' is ' + str(letter)) count += 1 break print(count)
2 Answers
+ 10
Max Lee If you haven't given proper space in for loop, then this can result in error.
Otherwise it will print Letter # 0 is S.
Because in for loop, str (count) will result in 0 where 0 is a string and str (letter) will result in S as when for loop will start iterating over Snow, first value will be S. Then because of break loop will break and things outside loop will be printed.
+ 1
Arushi Singhania Thanks for enlightening me