×
Reviews 4.9/5 Order Now

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

June 11, 2024
Martin Jonas
Martin Jonas
🇦🇺 Australia
Python
Dr. Martin Jonas, PhD in Computer Science from Southern Cross University, Australia. With 4 years of experience in Python assignments, I offer expert guidance and support to help you excel in your programming projects.
Key Topics
  • Instructions
  • Requirements and Specifications
Tip of the day
Leverage OCaml's strong type system to catch errors early. Write modular code using functions and pattern matching for better readability and debugging.
News
A new library for Swift that introduces advanced mathematical functions and types, facilitating complex numerical computations in Swift applications.

Instructions

Objective

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

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" else: part += pronounce[c] if c in vowels: result.append(part) part = "" prev = c if len(part) > 0: result.append(part) 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(pronounceWord(word.lower())) else: 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': break if __name__ == '__main__': main()

Similar Samples

Discover the quality of our work through these detailed samples. Each example showcases our expertise in various programming languages and problem-solving skills. Whether you're looking for assistance in Python, Java, C++, or any other programming language, our samples highlight the precision and proficiency you can expect from our services.