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
A(n) ____________________ is an assessment to determine the characteristics of hardware or software needed to meet a user's job
vampirchik [111]
<span>An user requirement is an assessment to determine the characteristics of hardware or software needed to meet a user's job requirements.
</span>The user requirements include the basic Hardware<span><span> (Central processing unit (CPU), memory, storage space, a keyboard, mouse, monitor..)</span>, hardware Maintenance and upgrades, software and software upgrades, data and information, technical support...
</span>

7 0
4 years ago
Which two items define a person's online identity? (choose two)
elena-14-01-66 [18.8K]
1 & 4 because social media’s are your identity and posts show what you’re doing and what you’re posting about yourself / other people.
8 0
3 years ago
"What is the term given to a design feature that consists of a window or window-like protrusion coming out of the roofline on a
LenKa [72]

Answer:

Dormer is the correct answer.

Explanation:

It is also the roof-like structured room that is on the top of the house. In simple words, It is the room in which a window which displays in a vertical manner from the sloping roof. It is the top room of the house.

So, the dormer is that type room which includes a window coming out on a roofline on a house.

6 0
3 years ago
You work as a Network Administrator for McNeil Inc. The company has a Linux-based network. You have just created a directory nam
timofeeve [1]

Answer:

E.

Explanation:

Based on the information provided within the question it can be said that the most likely cause is that David does not have the write permission on the directory. This permission basically grants the individual the ability to make changes to a certain file or directory. Therefore if David does not have write permission it would explain why he is unable to save his reports in that directory.

8 0
3 years ago
What are the primary benefits of relying on systems development standards?
Sunny_sXe [5.5K]

Answer:

The benefits of relying on System Development Standards is explained below.

Explanation:

There are many benefits of having a Well Defined Systems Development. It helps in having a pre - planned and well defined structure before the project starts. It helps in having a Clear view of the whole project and also each phase of the whole System Development. It helps in having an understanding of cost required and the revenues generated at each phase of the whole system development. It helps in having an understanding of the goal of each phase and procedures need to be followed for that particular goal. It also helps in having the quality checked and the improvements need to be made for the desired quality.

3 0
3 years ago
Other questions:
  • What is the highest payed country
    9·1 answer
  • ___ apps can allow you to lock your mobile device and sim card remotely.
    15·1 answer
  • Title text boxes on every slide must be the same format.<br><br> A) True<br> B) False
    8·2 answers
  • Keyshia is preparing a report about the different tools that are used in a science laboratory. She wants to edit a picture of gl
    11·2 answers
  • What version of android did nexus one run?
    14·1 answer
  • Which of the following things should you do first when planning your career?
    15·2 answers
  • In DTP, a good rule of thumb is to use as many special effects as you need to make your documents look interesting.
    5·1 answer
  • What is the name for unwanted software that installs when you click some links?
    13·2 answers
  • I need help. I wanna help a friend by giving him my powerpoint but I dont want him to steal my work. Is their anyway to restrict
    8·1 answer
  • Write any three primary activities of a program??​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!