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
elixir [45]
2 years ago
14

Write a loop that reads strings from standard input where the string is either "land", "air", or "water". The loop terminates wh

en "xxxxx" (five x characters) is read in. Other strings are ignored. After the loop, your code should print out 3 lines: the first consisting of the string "land:" followed by the number of "land" strings read in, the second consisting of the string "air:" followed by the number of "air" strings read in, and the third consisting of the string "water:" followed by the number of "water" strings read in. Each of these should be printed on a separate line. Use the up or down arrow keys to change the height.
Computers and Technology
1 answer:
____ [38]2 years ago
4 0

Answer:

count_land = count_air = count_water = 0

while True:

   s = input("Enter a string: ")

   if s == "xxxxx":

       break

   else:

       if s == "land":

           count_land += 1

       elif s == "air":

           count_air += 1

       elif s == "water":

           count_water += 1

print("land: " + str(count_land))

print("air: " + str(count_air))

print("water: " + str(count_water))

Explanation:

*The code is in Python

Initialize the variables

Create a while loop that iterates until a specific condition is met. Inside the loop, ask the user to enter the string. If it is "xxxxx", stop the loop. Otherwise, check if it is "land", "air", or "water". If it is one of the given strings, increment its counter by 1

When the loop is done, print the number of strings entered in the required format

You might be interested in
. Each ____ on a menu performs a specific action.
Fofino [41]
The answer would be d, none kf the above.
4 0
3 years ago
The Brinley website will not let me search for questions anymore. It says “Search all you want in-app” and then covers the quest
ira [324]

Answer: U can answer a few questions of other people’s questions then the question that was covered it unlocks after answering some questions and u will be able to see it or u could get the app too and it doesn’t block at all

Explanation:

4 0
2 years ago
Which is the correct expansion of the term Internet?
dem82 [27]

Answer:

international network is the answer

6 0
2 years ago
Read 2 more answers
Sarah has to add a picture from her computer file and add a caption to it. Arrange the steps in a correct sequence.
SVEN [57.7K]
Click Insert
click Picture
click From File
select the desired picture and again click insert
right-click the picture
click Insert Caption
write the caption and add it
5 0
3 years ago
Read 2 more answers
In which career does the level of education vary the most?
Ksenya-84 [330]
Journalism
all the best
3 0
3 years ago
Read 2 more answers
Other questions:
  • How to use translate on a website?
    15·1 answer
  • For conditional formatting, a formula must be in the form of a(n) _____ test that results in a true or false value. Question 1 o
    8·1 answer
  • Complete the sentence to identify advantages of top-down programming design. Choose all that apply.
    15·2 answers
  • 1 Point
    14·1 answer
  • Randy earn $22 per hour. This is an example of
    11·1 answer
  • Hi<br>is it right?<br>"I think there is a small mistake in the quotation(second not first)"​
    5·1 answer
  • Yeah help me please......................
    9·1 answer
  • You are a librarian! Ask the user for the last names of the authors of the five books they are returning. Print a list of those
    15·1 answer
  • CODEHS: WHY is it important to know the difference between div and span?
    11·1 answer
  • Criminal investigations are limited to finding data defined in the search ____.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!