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
Which type of computer graphic can be blown up to a much larger size without getting distorted or losing quality?
Daniel [21]
The answer is a. A Vector Graphic

Vector graphic uses polygones that represented by mathematical equations or proper tags that make it very coordination oriented and allow infinite enlargement without losing any quality

the most popular vector graphic format that being used today is SVG
5 0
3 years ago
​this is another name for the wireless configuration in which a central wireless device is used to serve all wireless clients.
Daniel [21]
Infrastructure mode is another name for wireless configuration in which a central wireless device is used to serve all wireless clients.
6 0
4 years ago
What is the difference between HTML and XML?
Luba_88 [7]

Explanation:

HTML displays data and describe the structure of a webpage while XML stores and transfers data.

7 0
2 years ago
Learning Task 2: Identify what is being asked. Write your answers on your notebook 1. What Microsoft Office program is used for
GenaCL600 [577]

Answer:

hi how are you Good afternoon

3 0
3 years ago
The stream cipher described in Definition 2.1.1 can easily be generalized to work in alphabets other than the binary one. For ma
Free_Kalibri [48]

Answer:

Check the explanation

Explanation:

1) supposing the keystream is a stream that is of random bits in Z26, we can describe a stream cipher based on the Latin Alphabet that is as follows (where A ↔ 0, B ↔ 1, C ↔ 2 etc):

y_{i} =x_{i} +k_{i} mod26

x_{i} =y_{i} -k_{i} mod26

2)

x_{i} =y_{i} -k_{i} = ” B ” − ” R ” = 1 − 17 = − 16 ≡ 10 mod 26 = ” K ” etc ·

The Decrypted Text is: ”KASPAR HAUSER”

8 0
3 years ago
Other questions:
  • Pointsyour company environment includes windows server versions 2003, 2008, and 2012. desktops range from windows xp and vista.
    13·1 answer
  • This assignment is to read from an input file and process the data for a group of people. Your program calculates the interest a
    5·1 answer
  • Identify the mobile device deployment option that gives the user flexibility to select a device, but allows the company to contr
    5·1 answer
  • Expressing your needs to others is aggressive behavior.<br> True or False?
    5·2 answers
  • To support continuous improvement efforts in the workplace, you increase the number of tasks that an employee performs and have
    7·1 answer
  • Narrowband Satellite Communications supports ______________ data rates for both mobile and fixed users by providing access on a
    8·1 answer
  • Describe some ways that you personally use information technologies differently than you did just a few years ago
    11·1 answer
  • How to code on python
    8·2 answers
  • What is social media ​
    13·2 answers
  • Whats the formatting of a letter to the editor?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!