1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Flura [38]
3 years ago
10

Write a Python function LetterGame() that repeatedly asks the user to input a letter. The function is to count the number of vow

els the user entered. The function should stop if the user enters a digit (0-9). a) Use a while-loop and in the while loop ask the user to input a letter or to input a digit to stop. b) Check if the user entered a vowel (if command is your friend) c) If the user entered a vowel increase the counter by one d) If the user entered a digit, output the number of letters the user entered and the number and percentage of vowels among them. e) Call the function. Expected output: You entered 10 letters, 2 of which were vowels. The percentage of vowels was 20%.
Computers and Technology
1 answer:
kotegsom [21]3 years ago
4 0

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

You might be interested in
What is the most important part of the course that you have learned about so far?
dusya [7]
Well what have you learned that you thought was beneficial to you?
8 0
3 years ago
Read 2 more answers
A ________ is a system of hardware and software that stores user data in many different geographical locations and makes that da
castortr0y [4]

Answer:

Content delivery network.

Explanation:

The content delivery network is also known as a network of content distribution it is a globally decentralized network of the proxy servers and the server farms.The main aim of a content delivery network is to giving the insularity of the high accessibility and efficiency by distributing the service to the end-user.

The content delivery network is a type of hardware and software network that stores u data in different geographical locations also giving the data available on the request.

7 0
3 years ago
Backing up data on a computer means
aleksklad [387]

Answer: when you back data up you are copying it and then moving the copy to another storage device

6 0
3 years ago
Read 2 more answers
1.5 code practice question 3
Svetach [21]

Answer: What the hell is that 243 suppose to be

Explanation:uhg

4 0
3 years ago
What type of data causes concern for institutions or business when collected, stored, and not secured properly
expeople1 [14]

Answer:

personal identeifying information

Explanation:

hope this is right and it helped

4 0
2 years ago
Other questions:
  • An administrator working on a Windows Server 2016 Server Core installation needs to disable DHCP on all interfaces on the server
    12·1 answer
  • A ____ is any manipulation of data, usually with the goal of producing information.
    9·1 answer
  • Explain free space allocation?
    9·1 answer
  • Ooooooooooooooooooooooooooooh im blinded by the lightssssssssss
    11·1 answer
  • The Maui coffee shop sells coffee at $10.50 a pound plus the cost of shipping. Each order ships for $0.86 per pound + $1.50 fixe
    14·1 answer
  • ____________________ software is a type of security software designed to identify and neutralize web bugs, ad-serving cookies, a
    8·1 answer
  • Key physical database design decisions typically do not include: A) choosing the storage format for each attribute from the logi
    12·1 answer
  • Clunker Motors Inc. is recalling all vehicles from model years 2001-2006. Given a variable modelYear write a statement that prin
    9·1 answer
  • You are the network administrator for a city library. Throughout the library, there are several groups of computers that provide
    12·1 answer
  • A service that enables a customer to build and run their own applications but doesn't include extensive access to hardware and m
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!