113k views
14 votes
Python 4.5 code practice

User Edgar H
by
3.5k points

1 Answer

9 votes

Answer:

"Write a loop that inputs words until the user enters DONE. After each input, the program should number each entry and print in this format:"

"#1: you entered _____"

"When DONE is entered, the total number of words entered should be printed in this format:"

"A total of ___ words were entered"

count = 0

data = input('Please enter the next word: ')

while data != "DONE":

count = count + 1

print("#" + str(count) +": You entered the word " + data)

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

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

Step-by-step explanation:

we are counting starting from 0 when the user inputs a word the code then counts the word and stores is as data and continues until the user inputs DONE

User BenjaminRH
by
3.2k points