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 part of a window lets you see a fileâs contents without opening the file?
Artyom0805 [142]
The preview pane. On the right hand side of the file explorer.
3 0
3 years ago
List and describe three options in the autocad object snap toolbar
miv72 [106K]
<span>END POINT : Snaps to the closest endpoint or corner of a geometric object. MID POINT : Snaps to the midpoint of a geometric object. CENTER : Snaps to the center of an arc, circle, ellipse, or elliptical arc.</span>
6 0
3 years ago
Since the password includes all four types of characters (complex password) and is 8 characters long, what is the real reason th
Liono4ka [1.6K]
It makes the possibility of an unwanted user to break into your account much smaller.
8 0
3 years ago
Q Basic program write a program in Q Basic to find the cost of 10 pens when the cost of 15 pens is 75 use unitary method to find
Ne4ueva [31]

give the function of cpu

5 0
3 years ago
Which statement regarding socializers is true?
allochka39001 [22]

Answer:

The answer is: they are comparable to suit of hearts

Explanation:

The answer is: they are comparable to suit of hearts

7 0
3 years ago
Read 2 more answers
Other questions:
  • Questions 6 - 9 Refer to the following code: public class WhatsIt { private int[] values; private double average; public WhatsIt
    7·1 answer
  • The acronym is used to define the process that allows multiple devices to share a single routable ip address.
    6·1 answer
  • Look at the circuit shown in the figure above. Switch S1 is open as shown, and R1 and R2 each have a value of 100 k. If you conn
    11·1 answer
  • Write a program to display the roll number of students who have scored 100 in math. display appropriate message if none have sco
    5·1 answer
  • It is necessary tto save updates often when working in google docs? True or false
    11·2 answers
  • GIVING BRAINLIEST Jenna creates advertisements for companies to air on television. Which file format will best preserve the grap
    5·2 answers
  • IN C++ PLEASE!!!! Define a function FilterStr() that takes a string parameter and returns "Good" if the character at index 4 in
    7·1 answer
  • Python - Write a program to print the multiplication table as shown in the image by using for loops.
    12·1 answer
  • Website designers work on the code and programming of a website, not the style or layout of the site.
    9·1 answer
  • Which of these problems is correct if the numbers are binary numbers?Group of answer choices1 + 1 = 21 + 1 = 100 + 0 = 11 + 0 =
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!