what is the answer to this question please? count = 0 for letter in 'Snow!': print('Letter # ' + str(count) + ' is ' + str(letter)) count += 1 break print(count)
With that munged indentation, it looks like "S" will print and count will equal 1. In Python, indentation is very important, so it's fairly impossible to be sure from your post.
Hi rsmith6559 thanks very much for your help! sorry for that munged indentation! the proper format is: count = 0 for letter in 'Snow!': print('Letter # ' + str(count) + ' is ' + str(letter)) count += 1 break print(count)
I guessed correctly then. The break statement will exit the for loop at the end of the first iteration.
I know you are right, when I put that answer in before, it mark it as wrong? my input that I put in was Letter # 0 is S1 is that the wrong format for the marker? thanks
If you run the program as is the output is : ------------ Letter #0 is S 1 ------------
Join our real-time social learning platform and learn together with your friends!