I need to write a function that will read syllables in a word (for example, HAIRY is 2 syllables). I have my code shown on the bottom and I\'m confident it works in most ca
you could use this as well using lambda map
fun_check = lambda x: 1 if x in ["a","i","e","o","u","y","A","E","I","O","U","y"] else 0 sum(list(map(fun_check,"your_string")))
in single line
sum(list(map(lambda x: 1 if x in ["a","i","e","o","u","y","A","E","I","O","U","y"] else 0,"your string")))