I'm writing a function to count the vowels in a given string in python, however when I try to run this program I am met with a NameError.
def vowels(s: str, start: int = 0, end: int = len(s)) -> int:
summ = 0
summ += s.count('a', start, end)
summ += s.count('e', start, end)
summ += s.count('i', start, end)
summ += s.count('o', start, end)
summ += s.count('u', start, end)
return summ
The NameError states that name 's' is not defined but I have no idea why. The error is pointing to the method header itself, not any lines within the method, hence why I added the variable types to the header and the return type of the method too, in the hopes that would fix it, but it did not. Any idea where this error could be coming from?