Answer:
def LetterGame():
vowels = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]
count1 = count2 = 0
while True:
choice = input("Enter a letter / digit to stop: ")
if choice.isdigit():
break
elif choice.isalpha():
count1 += 1
if choice in vowels:
count2 += 1
print("You entered " + str(count1) + " letters, " + str(count2) + " of which weere vowels.")
print("The percentage of vowels was " + str(count2 / count1 * 100) + "%")
LetterGame()
Explanation:
Create a function called LetterGame
Inside the function:
Create a list of vowels
Initialize count1, counts the total letters, and count2, counts the vowels
Initialize a while loop that iterates until the specified condition is met in the loop
Get the input from the user. If it is a digit, stop the loop. If it is an alphabet, increase the count1 by 1, and also check if it is a vowel. If it is a vowel, increment the count2 by 1
When the loop is done, print the required information
Finally, call the function