150k views
5 votes
Write a loop that inputs words until the user enters stop. After each input, the program should number each entry and print I. 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.

User Sinkeat
by
6.0k points

2 Answers

3 votes

Answer:

word = input("Please enter the next word: ")

count = 0

while word != "DONE":

count += 1

print("#{}: You entered the word {}".format(count, word))

word = input("Please enter the next word: ")

print("A total of " + str(count) + " words were entered.")

Step-by-step explanation:

Assuming this is python, this should help!

User Peter McNab
by
5.4k points
1 vote

Answer:

Written in Python:

userinp = input("Input: ")

count = 0

while not userinp == "stop":

print("You entered "+str(userinp))

count = count + 1

userinp = input("Input: ")

print("All done, "+str(count)+" words entered")

Step-by-step explanation:

I've added the full program as an attachment where I use comments to explain difficult lines

Write a loop that inputs words until the user enters stop. After each input, the program-example-1
User Gilbert Williams
by
6.1k points