Today’s five-minute starter

Connor’s code:

#set a variable for word count
#while a variable is true is true
#ask for a word and inform the user that they can quit
#if a word is entered
#add to the word count
#repeats the loop
#if they quit
#print out how many words they've entered
#break out of the loop

while WORD_COUNT >= 0:
  Word = raw_input("Please enter a word. Input x to quit ")
  #asks the user for an input
  if Word == "x":
    print ("You have put in %s words." % WORD_COUNT)
    #tells the user the total amount of words they've entered
    WORD_COUNT += 1 
    #adds to word count

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s