130k views
0 votes
I don’t know what is wrong with this please explain and put the code.

I don’t know what is wrong with this please explain and put the code.-example-1

1 Answer

2 votes

This code uses a while loop to repeatedly ask the user for the type of pet they have. If the user enters "stop," the loop breaks, and the program stops. Otherwise, it increments the pet_count and prints the information about the entered pet.

pet_count = 0

while True:

pet_input = input("What pet do you have? ")

if pet_input.lower() == "stop":

break

pet_count += 1

print(f"You have one {pet_input}. Total # of Pets: {pet_count}")

print("Program stopped.")

User Ivan Quintero
by
9.1k points