Write a python program that asks the user for a word, then calculates and prints the vowel worth of the entered word using these instructions: Suppose you calculate the vowel worth of a word based on the following instructions:
a 5 points e 4 points i 3 points o 2 points u 1 point.
My code:
word = str(input("Enter a word:"))
def vowel(Word):
global word
Word = word
score = 1
if "a" or "A" in word:
score += 5
elif "e" or "E" in word:
score += 4
elif "i" or "I" in word:
score += 3
elif "o" or "O" in word:
score += 2
elif "u" or "U" in word:
score += 1
print("Your word scored",score,"in the vowel checker")
print(vowel(word))
Edit: FOR LOOP
word = input("Enter a word:")
def vowel(Wo_rd): global word Wo_rd = word score = 0 for char in word.lower(): if char == 'a' or "A": score += 5 elif char == "e" or "E": score += 4 elif char == "i" or "I": score += 3 elif char == "o" or "O": score += 2 elif char == "u" or "U": score += 1 a = "Your word scored",score," in the word checker test" return a
print(vowel(word))