Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Syllable Count Function

Create a function that counts the number of syllables a word has. Each syllable is separated with a dash -.

number_syllables("buf-fet") ? 2

number_syllables("beau-ti-ful") ? 3

number_syllables("mon-u-men-tal") ? 4

number_syllables("on-o-mat-o-poe-ia") ? 6

Don't forget to return the result.
If you get stuck on a challenge, find help in the Resources tab.
If you're really stuck, unlock solutions in the Solutions tab.

This is what I came up with so far:
def number_syllables(word):
return word.split("-") and word.count(word)

1 Answer

The string.split() method is going to return a list. You don't need to return the list itself, just the count of items in the list.

Login / Signup to Answer the Question.