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.
(The answer posted about this, doesnt work for me)
1
Expert's answer
2020-12-06T10:23:11-0500
flag = True
i=0
while flag:
n = input("Please enter the next word: ")
word = str(n)
i=i+1
if n == "STOP":
print("All done. ",i," words entered.")
break
else:
print("You entererd ", n)
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment