Write a loop that reads strings from standard input where the string is either "land", "air", or "water". The loop terminates when "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.

Answers

Answer 1

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


Related Questions

DEF is a small consulting firm with ten on-site employees and 10 to 12 part-time (off-site) software consultants. Currently, the network consists of 2 servers for internal business processes, 1 server that handles the call-in connections; 10 on-site wireless workstations/devices, and 2 printers. Respond to the following in a minimum of 175 words: Identify one network security strategy that would help this organization. Why did you choose this strategy over others

Answers

Answer:

What i would suggest for the organization is to use the Testing Infrastructure strategy. it is good for your consulting firm because it is less costly and provide security.

Explanation:

Solution

There are different network security strategy which is listed below:

Segment the network:

Segmentation in network is very useful for providing security.If any threat is occur only one segment is effected remaining are safe and it is less cost process. very useful for small organizations.

Test your infrastructure :

Testing infrastructure also very good technique.

Always we have to test our infrastructure whether threat is occur or not.

If any threat is happen we can detect that easily by testing our infrastructure.

Regularly update anti-virus software :

This is very useful for small organizations and it is less cost.with less cost we can provide security for all devices like computer,server,modems etc.

Frequently backup your critical data :

This is very good technique for crucial data.If we backup important data any time that will be useful if any attack is happen.

This is less costs and simple.

Change router default security settings :

Changing router password and settings also helpful for providing security.If we maintain same password and same settings for a long time that may lead to data hacking.It is cost less process very useful for small organizations.

Other Questions
All of the following are true about hacksaws except: a. A hacksaw only cuts on the forward stroke. b. A coarse hacksaw blade (one with fewer teeth) is better for cutting thick steel than a fine blade. c. A fine hacksaw blade (one with many teeth) is better for cutting sheet metal. d. A hacksaw blade is hardened in the center, so it is best to saw only with the center portion of the blade. Each of the following is a confidence interval for = true average (i.e., population mean) resonance frequency (Hz) for all tennis rackets of a certain type:(111.6, 112.4) (111.4, 112.6)(a) What is the value of the sample mean resonance frequency? 5/a - 4/b as a single fraction Name one area of the world that has a low population density and explain one reason why On hearing my name, you might be reminded of long queues at metro stations or food courts. Just as a human body has a name for each of its parts, similarly I am an entity that identifies the part of the program like keywords, operators, identifiers, punctuation, etc Solve the system.2x + y = 3-2g = 14 6xWrite each equation in slope-intercept form.Y = ___x + ___Y = ___x + ___ "Definition" a. a characteristic that is not passed from one generation to the next in the genes but instead is acquired during the lifetime of an individual b. To mate two plants or animals to produce another generation c. A unit of DNA that determines a specific trait in an organism d. The transfer of traits from parents to their offspring e. A chart used to predict the proportion of offspring that will have a certain trait when two organisms are crossed f. A gene in a gene pair that is not expressed when paired with a dominant gene g. An organism that is the offspring of two similar organisms that are not the same species h. A gene in a gene pair that is always expressed i. A characteristic of an organism; for example, eye color, hair color, or height j. The science of heredity; the study of how traits are passed from parent(s) to offspring k. The discoverer of the basis of genetic theory l. When both genes from a homologous pair are identical m. Factors in the environment of an organism that limit the full expression of a gene n. A twisted and coiled strand of DNA within the nucleus that carries the codes for reproductive traits such as eye and hair color o. The strands of genetic material that determine traits of daughter cells (stands for deoxyribonucleic acid) p. When both genes from a homologous pair are different q. Two similar chromosomes; one from the mother and one from the father r. The links that hold the two sides of the DNA molecule together Read the excerpt from Hemingway's a farewell to arms. The major Asked me to have a drink with him and two other officers. We drank rum it was very friendly. What does the excerpt reveal about the narrator? In his first school year, Leo contributed $13,468 toward college expenses. In his second school year, the expenses are expected to increase by 4%. What is the approximate minimum amount Leo should expect to contribute in his second school year? $13,472 $13,868 $14,007 $18,855 EXPLAIN TWO WAYS IN WHICH THE WORK OF ANDREAS VESALIUS AND THE WORK OF JOHN HUNTER WERE SIMULAR Choose your favorite character from Beowulf, Grendel, or Le Morte d' Arthur. What modern values and/or universal themes are evident in the character? What does this tell us about how literature reflects society, culture, place, and/or history? ( 400 word essay) ( works cited page) Which of the following phrases is a dependent clause?A. After we are finished.B. Please move that chair into the corner.C. You are leaving us tomorrow.D. All of the choices are correct. The National Assembly took their oath not to leave until they had a constitution on a tennis court because what is the length of the line? segment AB is dilated from the origin to create segment A prime B prime at A' (0, 6) and B' (6, 9). What scale factor was segment AB dilated by? 1/2 2 3 4 a small number of finches live in a protected bird sanctuary natural selection is like least likely to occur in this population HELP PLEASE!!! Will mark brainliest! Muslims fast in memory of which event during the holy month of Ramadan? the Meccans acceptance of Muhammads teaching Muhammads first revelations from God Muhammads destruction of Arab icons in the Kaaba the birth of Muhammad in Mecca Terry has a number cube that is numbered from 1 to 6. She rolls the cube 50 times. Which equation can be used to predict the number of times that she will roll a number that is greater than 4? P (number greater than 4) = StartFraction 1 over 6 EndFraction (50) P (number greater than 4) = StartFraction 2 over 6 EndFraction (50) P (number greater than 4) = StartFraction 3 over 6 EndFraction (50) P (number greater than 4) = StartFraction 4 over 6 EndFraction (50) The protestant formation led to which of the following important changes in Europe? A. The renaissance spread from Italy to the rest of Europe. B. European militaries united to invade Muslim territories in Europe. C. The catholic Church split into Eastern and Western divisions. D. European religious minorities were persecuted in large numbers. can anyone help pls. 10 points