+1 (315) 557-6473 

Program To Determine If The Characters Are a Part of The Hawaiian Alphabet in Python Assignment Solution.


Write a program to determine if the characters are a part of the Hawaiian alphabet in python.

Requirements and Specifications

Source Code
# Hawaiian Language Pronunciation Guide
# Alicia Lopez
# This is a program that determines if words are valid in the Hawaiian language;
# as well as providing how to pronounce the entered word.
# This function determines if the characters are a part of the Hawaiian alphabet.
def checkWord(word):
    characters = ['a', 'e', 'i', 'o', 'u', 'p', 'k', 'h', 'l', 'm', 'n', 'w', ' ', '\'']
    for c in word:
        if c not in characters:
            return False
    return True
# This function shows how to pronounce the given word.
def pronounceWord(word):
    pronounce = {}
    pronounce['p'] = "p"
    pronounce['k'] = "k"
    pronounce['h'] = "h"
    pronounce['l'] = "l"
    pronounce['m'] = "m"
    pronounce['n'] = "n"
    pronounce['p'] = "p"
    pronounce['a'] = "ah"
    pronounce['e'] = "eh"
    pronounce['i'] = "ee"
    pronounce['o'] = "oh"
    pronounce['u'] = "oo"
    pronounce['\''] = "\'"
    pronounce[' '] = " "
    result = []
    prev = None
    part = ""
    vowels = ['a', 'e', 'i', 'o', 'u']
    for c in word:
        if c == 'w':
            if prev is None or prev == 'a' or prev == 'o' or prev == 'u':
                part += "w"
            elif prev == 'i' or prev == 'e':
                part += "v"
            part += pronounce[c]
        if c in vowels:
            part = ""
        prev = c
    if len(part) > 0:
    return str.join("-", result)
# The main function that utilizes an interactive loop.
def main():
    while True:
        word = input("Enter a word to check if it is a valid Hawaiian word: ")
        if checkWord(word.lower()):
            print(word, "is a valid Hawaiian word and is pronounced as:")
            print(word, "is a NOT valid Hawaiian word, please enter a VALID word to be pronounced")
        choice = input("Would you like to enter another word? Y/Yes or N/No? ")
        if choice[0].lower() == 'n':
if __name__ == '__main__':