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
Which of the following is time-dependant? Group of answer choices
Nookie1986 [14]

Answer:

A dynamic model accounts for time-dependent changes in the state of the system,

while a static model calculates the system in equilibrium, and thus is time-invariant.

Dynamic models typically are represented by differential equations or difference equations

7 0
3 years ago
Using digital modulation techniques such as ASK, FSK, or PSK results in a passband that appears at a higher frequency than the b
Aleksandr-060686 [28]

Answer:

The answer is "True".

Explanation:

Digital modulation is also known as a method, which uses common synchronization names and various types of signals to manipulate a carrier wave.

  • The analog method measures the radio signals in amplitude and frequency.
  • It provides more general usage in the firmware, that's why the answer to this question is true.
6 0
2 years ago
Estimating the cost of a network is ______ complex than estimating the cost of onenew piece of data processing hardware.a.much m
ipn [44]

Answer:

a

Explanation:

your answer is the first one

5 0
3 years ago
Explain how chord works. To increasing the fault tolerance in chord, each node maintains a successor list (finger table) instead
andrew11 [14]

Answer:

Chord is a set of rules for a peer-to-peer distributed hash table it collects key-value sets by allotting keys to several computers (known as "nodes"); a node will collect the values for all the keys for which that is reliable. Chord defines how keys are allocated to the nodes, and how a node can determine the value for a distributed key by first locating the node liable for such key.

Explanation:

A chord is a peer-to-peer lookup service. It Resolves the difficulty of establishing a data item in a combination of shared nodes, considering various node arrivals and removals The most crucial operation in most peer-to-peer method is the efficient position of data objects.

It is able of supporting only one operation i.e. given a key, it maps the key on a link.

Algorithm:

Algorithm shows working of the chord:

// x is a node used to find successor of id

x.find_successor(id)

if (id (x; successor])

return successor;

else

// query is being delivered around the circle

entrance successor.find_successor(id);

6 0
3 years ago
Drivers must always yield to emergency vehicles traveling
alina1380 [7]

True. Drivers must always yield to emergency vehicles traveling. Emergency vehicles always have the right of way, and other cars on the road need move out of their way when they see them driving with their hazards on. If there are no emergency lights or sirens, then it is okay to treat these vehicles like another vehicle on the road.

4 0
3 years ago
Other questions:
  • How can development in ICT be utilized to speed up the development and integration efforts
    15·1 answer
  • In steps<br> Urgent please
    14·1 answer
  • How is the execution speed of machine language compared to that of high-level languages? The execution speed of machine language
    10·2 answers
  • Even though a high-level programming language
    11·1 answer
  • Josephine is in the process of creating ads within her Standard Display campaign. She finds that there are two main ad formats t
    14·1 answer
  • Describe the procedure for creating a table or spreadsheet in a presentation slide.
    13·1 answer
  • __________ are hosted on dedicated computers known as 'web servers'.​
    8·2 answers
  • Please hurry
    15·2 answers
  • Two technicians are discussing Newton's first law of motion. Technician A says that a lightweight vehicle requires as
    8·1 answer
  • Question #2: How would you demonstrate professionalism in a video call with a teacher? Edmentum Digital world Please Help!!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!