Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14185

I am trying to make a diphthong counter, and i cannot seem to get it count all diphthongs present within the word

$
0
0
word = input("Tell me the word you wish to check for diphthongs: ")total = 0diphthongs = ['ue', 'ie', 'ae', 'ee', 'oe', 'ui', 'ii', 'ai', 'ei', 'oi', 'ua', 'ia', 'aa', 'ea', 'oa', 'uo', 'io','ao', 'eo', 'oo', 'uu', 'iu', 'au', 'eu', 'ou']stripped = word.strip('abcdfghjklmnpqrstvwxyz')for letter in diphthongs:    if letter in stripped:        total += 1print("There are", total, "diphthongs in the string")

It can count 1 diphthong, but doesn't recognize the same diphthong twice, like c[ou]rth[ou]se, I also need to make it not recognize qu when searching for diphthongsPlease and thank you?

I have tried splitting the diphthongs into regular vowels, I have tried range and len functions, but none seem to make it any easier, and the best results have come from what I have used so far.


Viewing all articles
Browse latest Browse all 14185

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>