I'm kind of stuck on this challenge
the objective is: "Create a function that counts how many D's are in a sentence."
Some examples:
count_d("My friend Dylan got distracted in school.") ➞ 4
count_d("Debris was scattered all over the yard.") ➞ 3
count_d("The rodents hibernated in their den.") ➞ 3
Here's my current code:
def count_d(sentence):
print(sentence)
sentence = sentence.lower
substring = "d"
return sentence.count(substring)
When I run it, the console sends an error message:
ERROR: Traceback:
in <module>
in count_d
AttributeError: 'builtin_function_or_method' object has no attribute 'count'