HW 6

Due Wednesday before lecture

This HW contains two loop exercises. Print this webpage out, and fill it out in pencil. We are doing this one on paper so you have practice in this format for the 6-week exam.

  1. Fill in the following program to count the number of 'y' letters in a user's input sentence.

    s = input("Type a sentence: ")
    
    
    
    
    	     
    
    
    
    
    print(numletters)   # you must fill this variable in your solution
  2. Fill in the following program to ask the user for one word, repeatedly, and print "YES" if the word ends with an "s". Finish with the input "DONE" and say Goodbye. The output should be like this:

    Word? happy
    Word? sauce
    Word? jokes	       	       
    YES
    Word? midshipmen	       	       	       
    Word? middies	       	       
    YES
    Word? hamburgers	       	       
    YES
    Word? DONE
    Goodbye	       	       	     

    Write your solution here:

    s = input("Word? ")