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
NBA bank uses centralized client server database that is accessed by all its nationwide branches. All customers' records are sto
lisov135 [29]

Answer:

NBA bank data is completely destroyed since it has not maintained any backup.

Explanation:

All businesses should maintain backup of important records. NBA bank has centralized client server database. This database record should be backup at different system which is only accessed when there is some problem in the original data. The backup system is initiated when the original database is destroyed.

4 0
3 years ago
Which description of the plain text file format is most accurate?
Sedbober [7]

Answer:

uses binary code to store data!

Explanation:

5 0
3 years ago
What will happen when a user attempts to login to salesforce from an ip address that is outside the login ip range on the user's
podryga [215]

Answer:

The answer to this question is option "d".

Explanation:

The answer is user will not be able to login at all. The user wants to log in to the salesforce by its IP address. But in the server, all the IP addresses will be registered for their special work. When the user inserting their IP address to log in to the salesforce. The first server will be checking into there database. If IP address doesn't match it will not permit to access salesforce because in their server it is not a valid IP address. It is registered in sever but not for this user.

So the answer to this question is option "d".

7 0
3 years ago
Uses of the following button in a keyboard: Prt SC, Home, Shift, Tab, Pg Up.​
creativ13 [48]

Answer:

This Print Screen key is used to take the screenshots of all that is appearing on the screen, and this can then be pasted in paint and saved in some location of the computer.

The Home key takes the cursor from the current position to the top left, or the start of the file.

Shift: There are two shift keys. And they are used to print the character in the capital. And when the caps lock is busy it can be used to print in lower case. It is also used together with arrow keys to select a part of the text.

Tab: This key moves the cursor from the current location to the location which we know as tab stops ( and the very next one).

Pg Up:​ The page up is being used for scrolling up, and the distance to which limit the scrolling will take place depends upon the application you are working on.

Explanation:

Please check the answer.

4 0
3 years ago
Which is true regarding pseudocode?
bearhunter [10]

Answer:

It uses simple words and symbols to communicate the design of a program

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer on how to perform a specific task and solve a particular problem.

A software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications. There are seven (7) main stages in the creation of a software and these are;

1. Planning.

2. Analysis.

3. Design.

4. Development (coding).

5. Testing.

6. Implementation and execution.

7. Maintenance.

A pseudocode refers to the description of the steps contained in an algorithm using a plain or natural language. Also, a pseudocode gives a summary of the steps adopted during a software development process using simple (concise) words and symbols.

This ultimately implies that, a pseudocode uses simple words and symbols to communicate the design of a program.

8 0
2 years ago
Read 2 more answers
Other questions:
  • you want to discard your old computer ,want to securely erase that data from your hard drive. what can you use to do this and wh
    12·1 answer
  • Styles are modified by using the Office clipboard in the Home tab. true or false
    5·2 answers
  • Write the method public static doublell quizAverages (double (1 scores). which takes a 2D array of doubles that represent quiz s
    11·1 answer
  • La computadora es un medio de comunicacion moderno?
    8·1 answer
  • Witch of the following is a valid why a scientist might a scientific theory
    13·1 answer
  • Does Buzz or APEX shows all your due assignments on the left of the main home screen?
    11·1 answer
  • A group of developers for a startup company store their source code and binary files on a shared open-source repository platform
    14·1 answer
  • I made a mistake. I'm building my first PC and I bought a Ryzen 7 3800x and planning on getting a 2070 super (if I can). What I
    9·1 answer
  • Leroy wants to keep the bride and groom in a picture, but remove the rest of the family. Which photo-editing tool should Leroy u
    14·1 answer
  • 3. The following is a dump of a UDP header in hexadecimal format. 0045DF000058FE20 a. What is the source port number? b. What is
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!