230,335 views
29 votes
29 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 Eugene Glova
by
3.2k points

1 Answer

17 votes
17 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 Zambesianus
by
2.7k points