Python Nested If-else Statements
I have a statement like this for word in tweet_text: if word in new_words: if new_words[word] == 0: new_words[word] = sent_count else:
Solution 1:
The else
clause corresponds to the if
on the same level of indentation, as you expect.
The problem you see may be due to the fact that you are mixing tabs and spaces, so the apparent level of indentation is not the same as the one your interpreter sees.
Change all tabs into spaces and check if the problem goes away.
Post a Comment for "Python Nested If-else Statements"