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]
3 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]3 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
If you want a user to enter exactly 20 values which loop would be the best to use
miskamm [114]
The answer to this is 'for'
3 0
3 years ago
A numeric literal that is written with a decimal point is called a ________. real number floating-point value decimal literal do
Kamila [148]

Answer:

floating point value

Explanation:

float: 1.235

integer: 8

boolean: 0 or 1

6 0
3 years ago
Which feature in word automatically corrects typos, minor spelling errors, and capitalization as you type? autocomplete spelling
Fed [463]
I think auto correct.....,
8 0
3 years ago
Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the int variable
Brilliant_brown [7]

Answer:

int main()

{

   double pH;

   int neutral;

   int base;

   int acid;

   cout<<"Enter a pH Value";

   cin>> pH;

   if(pH<7.0){

       neutral =0;

       base=0;

       acid= 1;

   }

   else if (pH=7.0){

       neutral =1;

       base=0;

       acid= 0;

   }

   else{

       neutral =0;

       base=1;

       acid= 0;

   }

   cout <<"The neutral, Base and Acid Values are: "<<neutral<<","<<base<<","<<acid<<" Respectively"<<endl;

   return 0;

}

Explanation:

Using multiple if/elseif/else statement the following problem is solved with C++

4 0
3 years ago
Fish Aquarium System of functional and Non-Functional requirement of the system.
Alborosie

<em>hoping</em><em> that</em><em> </em><em>it </em><em>was </em><em>helpful</em><em> to</em><em> </em><em>you</em>

<em>plz </em><em>mark </em><em>me </em><em>as </em><em>brainlist</em><em> answer</em>

7 0
2 years ago
Other questions:
  • Which one of the following terms is defined as the material and surfaces upon which an artist works?
    9·1 answer
  • ¿Qué 3 objetos son productos tecnológicos?
    9·1 answer
  • In a fully underwritten offering a firm sells 1 million shares of stock through a fully underwritten offering. Their banker char
    10·1 answer
  • Can someone help me with my homework?
    7·1 answer
  • Write a method called printGrid that accepts two integers representing a number of rows and columns and prints a grid of integer
    11·1 answer
  • Write a Java program that reads two numbers from the console. Based on the example in the textbook, write five methods (min, max
    14·2 answers
  • HELP PLSSSSS!!! I WILL MARK BRAINLIEST FOR THE FIRST AND CORRECT ANSWER!!!
    14·2 answers
  • Which of the following statements is true about DVI connectors? *
    10·1 answer
  • Which of the following is not a benefit provided by a stakeholder analysis document
    7·1 answer
  • In python, sorry if it’s blurry
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!