Python 3.7.4: Write a loop that reads strings from standard input, where the string is either "duck" or "goose". The loop terminates when "goose" is read in. After the loop, your code should print out...


Python 3.7.4:


Write a loop that reads strings from standard input, where the string is either "duck" or "goose".


The loop terminates when "goose" is read in.


After the loop, your code should print out the number of "duck" strings that were read.


-----------------


This is what I tried so far, and it's been marked wrong by MyProgrammingLab:


count = 0
inputstring=input("Enter goose/duck: ")
countducks=0
while inputstring!="duck":
    countducks+=1
    inputstring=input("Enter either the word goose or duck: ")
print(countducks, "This is the number of times duck was entered:" count)



Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here