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]
2 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]2 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
"Memory refers to: A.the brain processes involved in the encoding, storage, and retrieval of information. B.the mechanisms drivi
natali 33 [55]

Answer: A

Explain:

you can use memory on a computer to retrieve passed data if your referring to brains memory that is memory of passed events

memory:1 the faculity by which the mind stores and members information

2 something remembered from the past a recollection

8 0
3 years ago
Ano ang maikling kwento??
marishachu [46]

Answer with Explanation:

Ang "maikling kuwento" ay isang uri ng<em> kathang-isip</em> na may pagkapareho sa nobela. Ito'y may buong tema ngunit mas maikli kaysa sa nobela at mas madali rin itong matapos basahin. Hango ito sa mga tunay na pangyayari sa buhay ng tao. Binubuo ito ng limang elemento: <em>tauhan, tagpuan, hidwaan, tema at plot. </em>Ito'y may balak na pukawin ang damdamin ng nagbabasa ayon sa kalagayan ng mga tauhan sa kuwento at ito'y nag bibigay ng mabuting aral.

Si <em>Edgar Allan Poe</em> ang tinaguriang<em> "Ama ng Maikling Kuwento." </em>

3 0
3 years ago
Write a short paragraph explaining why cross-training employees is imperative.
harina [27]
<span>One of the main deterrents to cross-training is how employees feel about retaining knowledge. An employee may feel their job is threatened if someone else is being trained in their function. It's important that you lay these woes to rest and explain why you are cross-training your employees.</span>
4 0
3 years ago
your organization has decided to use dhcp for ipv6. you want all windows 10 systems using ipv6 to get all of their tcp/ip inform
timurjin [86]

your organization has decided to use dhcp for ipv6. you want all windows 10 systems using ipv6 to get all of their tcp/ip information through dhcp. By setting up a Stateful network would you set up the network .

Why is DHCP utilized and what does it do?

Network devices are set up to communicate on an IP network using the Dynamic Host Configuration Protocol (DHCP).

                           A DHCP client utilizes the DHCP protocol to request configuration data from a DHCP server, including an IP address, a default route, and one or more DNS server addresses.

What are DHCP and DNS?

It is possible to translate domain names (like its.umich.edu) into IP addresses using the Domain Name System (DNS) on the Internet.

                          In order to automatically assign IP addresses and other parameters to devices when they connect to a network, there is a mechanism called Dynamic Host Configuration Protocol (DHCP).

Learn more about DHCP Server .

brainly.com/question/29432103

#SPJ4

5 0
1 year ago
What is an example of a way a farm could apply new technology to improve sustainability
Agata [3.3K]

An example of a way a farm can apply new technology to ensure sustainability is: D. the use of artificial intelligence to predict and adjust the farms water usage.

<h3>What is Precision Agriculture?</h3>
  • Precision Agriculture can be defined as a management strategy that employs artificial intelligence (AI) in collating, processing and analyzing different form of data and information in order to support farm management decisions to increase efficiency and sustainability of agricultural production.
  • Examples of precision agriculture includes the use of drones, irrigation technologies, and Global Positioning Systems (GPS).

Therefore, an example of a way a farm can apply new technology to ensure sustainability is: D. the use of artificial intelligence to predict and adjust the farms water usage.

Learn more about precision agriculture on:

brainly.com/question/25110597

8 0
2 years ago
Other questions:
  • A switch operates in the OSI reference model __________ layer and uses the __________ address to forward packets.
    8·1 answer
  • A student is helping a friend with a home computer that can no longer access the Internet. Upon investigation, the student disco
    9·1 answer
  • Which phone has the most GB (Gigo Bites)<br><br>A.Samsung<br>B.Iphone<br>C.LG<br>D.ZTE
    10·2 answers
  • A colleague asks you to research a CPU for a new server that will run Windows Server 2019. He explains the server roles that he
    7·1 answer
  • Jenny is the project manager and her company. She needs to break her current project into parts that her employees can work on.
    10·1 answer
  • Which is the last step in conducting a URL search?
    14·2 answers
  • Question # 5
    6·1 answer
  • How do you open an application on the macOS?
    11·2 answers
  • Which of the following is true about named ranges?
    6·1 answer
  • Because his father _____ his ten-speed bike away to punish him for his failing grades, the boy sulked for two days.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!