Write a loop that inputs words until the user enters STOP. After each input, the program should number each entry and print in this format:
#1: You entered _____
When STOP is entered, the total number of words entered should be printed in this format:
All done. __ words entered.
Sample Run
Please enter the next word: cat
#1: You entered cat
Please enter the next word: iguana
#2: You entered iguana
Please enter the next word: zebra
#3: You entered zebra
Please enter the next word: dolphin
#4: You entered dolphin
Please enter the next word: STOP
All done. 4 words entered.
1
Expert's answer
2020-12-13T22:48:46-0500
def loopDemo():
c=0
word="empty"
while (word != "STOP"):
word = input("Enter a word, STOP to end the loop: ")
if word != "STOP":
c+=1
print("#"+str(c)+": You entered "+ word)
print( "All done "+ str(c) +" words entered")
//Driver code
loopDemo()
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment