Break is not activated inside a for loop in Python [closed]
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 months ago . I want to print the first 10 key-value pairs from the dictionary word_index and I wrote this code: for key, value in enumerate(word_index): count = 0 if count <10: print(f'key {key} : value: {value}') count = count + 1 else: break As you can see the break is not activated. Why is that? What I should change in