Answer to Question #104096 in Python for nick

Question #104096
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.
1
Expert's answer
2020-03-04T09:44:23-0500
num = 0

while True:
    word = input('Please enter the next word: ')
    if word == 'STOP':
        break
    else:
       num += 1
    print('#{}: You entered {}'.format(num, word))
if num == 1:
    print( 'All done. 1 word entered.')
else:
    print( 'All done. {} words entered.'.format(num))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS