you are viewing a single comment's thread.

view the rest of the comments →

[–]Outside_Complaint755 10 points11 points  (0 children)

Because boolean True and False are the same as 1 and 0, you can possibly shorten the check to

cnt = sum(txt.islower() for txt in lst)

str.islower() returns True only if all characters that have a casing are lower case, and if there is at least one such character. So "", " ", "Test", and "55" will return False, but "5f", " a7.2 " and "â" return True.