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 at: 2023/04/06 14:18; Updated at: 2023/04/08 09:00
The question is resolved.