Computer Science, asked by no3767314, 2 months ago

Write a python program that prompts the user to enter five words if the length of any word is less than 6 characters, then it asks the user to enter it again. However, if the length word is 6 and greater than 6 then display it on screen.

Answers

Answered by dreamrob
3

Program:

i = 1;

while i <= 5:

   s = input("Enter a word : ")

   if len(s) < 6:

       print("The length of the word is less than 6. Please enter the word again.\n")

   else:

       print(s, "\n")

       i = i + 1

Output:

Enter a word : Nirali

Nirali  

Enter a word : Shivi

The length of the word is less than 6. Please enter the word again.

Enter a word : Ansh

The length of the word is less than 6. Please enter the word again.

Enter a word : Anuradha

Anuradha  

Enter a word : Rajiv

The length of the word is less than 6. Please enter the word again.

Enter a word : Sankalp

Sankalp  

Enter a word : Harshita

Harshita  

Enter a word : Pihu

The length of the word is less than 6. Please enter the word again.

Enter a word : Preeti

Preeti

Similar questions