Question: Write a program with a loop that repeatedly reads a string as input, where the string is either duck or goose. The loop terminates when
Write a program with a loop that repeatedly reads a string as input, where the string is either "duck" or "goose". The loop terminates when "goose" is entered. After the loop, your code should print out the number of "duck" strings that were read. NOTE: When reading the input, do not display a prompt for the user. Use the input() function with no prompt string. Here is an example: bird = input() .
Please Can I get answer that with python ( WITH SENTINEL)?
I answer that program as below but it doesn't going through with python please can you fix that to me and thanks?
bird = input() count = 0 while bird!="goose": bird = input() count += 1 print("Number of duck strings that were read is",count)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
