Light Mode
Dark Mode
Line 10 and 11 question

May I know why must Line 10 and 11 be at the end of the for loop and not part of the if else for count > 2

def checkio(words: str) -> bool:

    newWord = words.split()
    count = 0
    for x in newWord:
        if x.isalpha():
            count += 1
        else:
            count = 0
        if count > 2:
            return True
    else:
        return False
Created: Oct. 21, 2019, 3:20 a.m.
Updated: Oct. 21, 2019, 7:35 a.m.
0
8
User avatar
mdabdillah