54.3k views
4 votes
Write a loop that continually asks the user what pets the user has until the user enters stop, in which case the loop ends. It should acknowledge the user in the following format. For the first pet, it should say You have one cat. Total # of Pets: 1 if they enter cat, and so on.

Write a loop that continually asks the user what pets the user has until the user-example-1
User Joshperry
by
6.5k points

1 Answer

2 votes

Answer:

pets = []

pet = input('What pet do you have? ')

while pet != 'stop':

pets.append(pet)

print('You have one ' + pet + '. Total # of Pets: ' + str(len(pets)))

pet = input('What pet do you have? ')

User Daniel Stefaniuk
by
7.7k points