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.

Expert's answer

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))
LATEST TUTORIALS
APPROVED BY CLIENTS