← Back to challenges

How Many D's Are There?

PythonMediumalgorithmsstringslanguage_fundamentals

Instructions

Create a function that counts how many D's are in a sentence.

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

Notes

  • Your function must be case-insensitive.
  • Remember to return the result.
  • Check the Resources for help.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Sum Greater Than Five