Light Mode
Dark Mode
one mistake

Looking at the solutions in the hints and found a small error:

def non_empty_lines(text: str) -> int:
    # Here we are not using a row counter, but a list of non-empty rows.
    # And as a result, we return its length using len()
    return len(x for x in s.split("\n") if x.strip())

missing square brackets:

return len([x for x in text.split("\n") if x.strip()])

Maybe it will be important for someone...

Created: April 6, 2023, 2:18 p.m.
Updated: April 8, 2023, 9 a.m.
0
22
User avatar
flowerinapot