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
frosja888 [35]
3 years ago
12

Write a loop that continually asks the user what pets the user has, until the user enters "rock", in which case the loop ends. I

t should acknowledge the user in the following format. For the first pet, it should say "You have a dog with a total of 1 pet(s)" if they enter dog, and so on.
Sample Run:
User enters:
lemur parrot cat rock
Outputs:
You have a lemur with a total of 1 pet(s)
You have a parrot with a total of 2 pet(s)
You have a cat with a total of 3 pet(s)
Computers and Technology
1 answer:
DedPeter [7]3 years ago
7 0

Answer:

Check the explanation

Explanation:

The Python program that frequently asks the user what pets the user has,

until the user enters "rock", in which case the loop ends can be analysed in the written codes below.

'''

# count of pets

count = 0

# read the user input

pet = input()

# loop that continues till the user enters rock

# strip is used to remove the whitespace

while pet.strip() != 'rock':

  # increment the count of pets

  count += 1

  # output the pet name and number of pets read till now

  print('You have a %s with a total of %d pet(s)' %(pet.strip(),count))

  pet = input() # input the next pet

#end of program

You might be interested in
Which of the following statements is false? a. Racks and bins are examples of storage equipment. b. Automation refers to equipme
svp [43]

Answer:

b. Automation refers to equipment that complements, rather than replaces, human contact.

3 0
4 years ago
Which file extension takes less storage space?
anyanavicka [17]

I believe the answer would be the JPEG file extension.

4 0
3 years ago
Read 2 more answers
What is the output, if userVal is 5? int x; x = 100; if (userVal != 0) { int tmpVal; tmpVal = x / userVal; System.out.print(tmpV
spayn [35]

Answer:

The output is 20

Explanation:

This line divides the value of x by userVal

tmpVal = x / userVal;

i.e.

tmpVal = 100/5

tmpVal = 20

This line then prints the value of tmpVal

System.out.print(tmpVal);

i.e 20

Hence, The output is 20

4 0
3 years ago
The font size on presentation slides should not be smaller than _____ -point.
fredd [130]
The font size should not be smaller than 24 points.
3 0
4 years ago
Read 2 more answers
In a black box model are the customers told that they should be expecting to be haxked?
Licemer1 [7]
Uhhhhhhhhhhh maybe tbh i have noooo idea.
6 0
3 years ago
Other questions:
  • Apakah maksud input dan output ?<br>​
    12·1 answer
  • D-H public key exchange Please calculate the key for both Alice and Bob.
    12·1 answer
  • What are the advantages and disadvantages of it?
    14·1 answer
  • An ergonomic keyboard is one that has been designed to fit the natural placement of your hands.
    14·2 answers
  • (A) writer or word <br> (B) Calc or Excel <br> (C) impress or PowerPoint<br> (D) none of these
    14·1 answer
  • Which type of software coordinates the hardware and software of a computer to work efficiently and productively?
    5·2 answers
  • What is different between attaching a file on an email program versus a smartphone?
    12·2 answers
  • Why might you choose a Macintosh operating system rather than a Linux operating system?
    5·2 answers
  • What is Product Owner work that a Product Owner might delegate?
    10·1 answer
  • Write a program that will input temperatures for consecutive days. The program will store these values into an array and call a
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!