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
In object-oriented analysis, an object is a member of a(n) _____, which is a collection of similar objects.
Advocard [28]

In object-oriented analysis, an object is a member of a CLASS, which is a collection of similar objects. It is a software engineering method.

<h3>Object-oriented analysis </h3>

Object-oriented analysis and design can be defined as a software engineering methodology.

This methodology (object-oriented analysis) is used to model a system as a particular group of interacting objects.

The object-oriented analysis is characterized due to the fact that objects are organized according to particular classes.

Learn more about object-oriented analysis here:

brainly.com/question/3522354

3 0
2 years ago
Why computer known as tool of information​
S_A_V [24]

Answer:

because it has the ability to capture the whole information you need or downloaded

8 0
2 years ago
A series of dialog boxes that guides you through creation of a form or report is called a ____.
victus00 [196]

Answer:

c i think it mit be right i'm sorry if it's not ,

Explanation:

it's c or D.

4 0
2 years ago
our client, Rhonda, has come to you for advice. Rhonda has recently graduated from college and has a good job with a large compa
Radda [10]

Answer:

See explaination for how to manage her personal risk

Explanation:

Personal risks can be described as anything that exposes you to lose of money. It is often connection to financial investments and insurance.

The basic things She can do to manage her personal risks are:

1. Saving:

Savings in much ways drastically reduces the percentage of risks and help you build confidence. Savings can help Rhonda manage her personal risks as savings helps one become financially secure and provide safety in case of emergency.

2. Investing:

After savings comes the major process, which is investment. It is rightly said, savings without invested proper is vain. Investment not only gives you returns or generates more profits but also ensures present and future long term financial security.

3. Reduce expenses:

A common man's expenses can never finish except it is controlled. Reduction in daily expenses can give a hike in savings and increase return on investment. Prompt planning can help cut in expenses.

5 0
3 years ago
Flodding on rivers is caused by human activity rather than natural events true or false
ValentinkaMS [17]

Answer:

True

Explanation:

While I believe it's a compendium of the both(both true and false), I when asked to pick just one, I would go with yes. They're are lots of things we humans do on a general note that causes flooding. Although, heavy rainfall can also cause flooding and that's not as a result of human activity, but directly. But then, activities like not maintaining a dam, or erecting a structurally failed dam can cause flood to occur at any point in time, without warning even. Another way is when due to our activities, we block the rivers, this can also lead to flooding exactly like the case of heavy rainfall does. Lack of good drainage facilities, drainage wouldn't create itself, we as humans do. When we don't were essentially creating an excuse for an eventual happening of flood.

Succinctly put, human activities also cause floods, as much as natural events causes flood.

3 0
3 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
  • Having just one error on a cover letter may eliminate an applicant from being considered for employment?
    13·1 answer
  • Which of the following is not true about VOIP?
    9·1 answer
  • What is the definition of a digital signal?
    14·1 answer
  • 14. Which of the following information about the ESRT T-teen rating rating is FALSE?
    15·1 answer
  • We will create a shopping cart, it is a dictionary mapping items in the car to the amount of that item. For example if there is
    9·1 answer
  • Write an algorithm to verify a number as even​
    9·1 answer
  • Why Use LinkedIn AI Automation Tools to Grow Your Sales Pipeline?
    7·1 answer
  • Write a boolean expression that is true if s references the string end.
    8·1 answer
  • What is a software program for navigating the web and displaying websites and pages?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!