We can also use format() to treat vowel harmony. Choose a simplevowel harmony system and show how this might work.
Question
We can also use format()
to treat vowel harmony. Choose a simple vowel harmony system and show how this might work.
Solution
Vowel harmony is a phonological process where the vowels of a word must share certain features. A simple example of a vowel harmony system is found in Finnish language. In Finnish, vowels are divided into two groups: front vowels (ä, ö, y) and back vowels (a, o, u). A word cannot contain both front and back vowels.
Here's how we might use the format()
function in Python to handle this:
def vowel_harmony(word):
front_vowels = "äöy"
back_vowels = "aou"
for char in word:
if char in front_vowels and any((vowel in back_vowels) for vowel in word):
return "Word does not follow vowel harmony"
if char in back_vowels and any((vowel in front_vowels) for vowel in word):
return "Word does not follow vowel harmony"
return "Word follows vowel harmony"
word = "sauna"
print("{}: {}".format(word, vowel_harmony(word)))
word = "hyvä"
print("{}: {}".format(word, vowel_harmony(word)))
In this code, we define a function vowel_harmony()
that checks if a word follows the rules of vowel harmony. We then use format()
to print out the word and whether it follows vowel harmony. The words "sauna" and "hyvä" are examples of words that follow and do not follow vowel harmony, respectively.
Similar Questions
Define a class to accept a string and convert it into uppercase. Count and display thenumber of vowels in it.
Define a class to accept a string and convert it into uppercase. Count and display thenumber of vowels in it.Input: roboticsOutput: ROBOTICSNumber of vowels: 3
Select the three vowel patterns that you are using to spell in this lesson. aw/ae/ai1au/al/ai2aw/ao/ae3aw/au/al4
In how many way different ways can be letters of the word ‘SOFTWARE’ be arranged in such a way that the vowels come together
Write a C program to check whether an alphabet is vowel or consonant using switch case
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.