• why is text.count('\n') not working?

Question related to mission Non Empty Lines

 

I looked at the methods of a string and came across the method count(). That's why I thought I could use it, but I must have overlooked something.

I don't see my error, can anyone help me?

def non_empty_lines(text: str) -> int:
    return text.count("\n")

Here is the complete code:

def non_empty_lines(text: str) -> int:
    return text.count("\n")


print("Example:")
print(non_empty_lines("one simple line\n"))

# These "asserts" are used for self-checking
assert non_empty_lines("one simple line\n") == 1
assert non_empty_lines("") == 0
assert non_empty_lines("\nonly one line\n            ") == 1
assert (non_empty_lines("\nLorem ipsum dolor sit amet,\n\nconsectetur adipiscing elit\nNam odio nisi, aliquam\n")== 3)

print("The mission is done! Click 'Check Solution' to earn rewards!")