asked 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

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? ')

answered
User Daniel Stefaniuk
by
9.4k points