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.

IN PYTHON PLEASEEE

Respuesta :

I hope this helps you.

Ver imagen Cytokine

Following are the Python program to input string value and count its value.

Program Explanation:

  • Defining a method words.
  • Inside a method, an integer variable "c" and string variable "word" is declared, and a while loop is defined.
  • Inside the loop, we input the string value and define a conditional statement is declared that checks word value not equal to STOP.
  • In this, it counts total input values and prints the value with the message.
  • At the last, we call the method.

Program:

def words():#defining a method words

   c=0#defining an integer variable c

   word="empty"#defining a string variable

   while (word != "STOP"):#defining a loop that runs when word value is not equal to STOP

       word = input("Please enter the next word: ")#using word that inputs value

       if word != "STOP":#defining if block that checks word value not equal to STOP

           c+=1#incrementing c value

       print("#"+str(c)+": You entered "+ word)#print input value with message

   print( "All done "+ str(c) +" words entered")#print total count of input value

words()#calling method

Output:

Please find the attached file

Learn more:

brainly.com/question/18750495

Ver imagen codiepienagoya