Assignment 12 — stringing lists

Due Monday, September 23


Advice


Program aeschylus.py

Algorithm to be followed

  • What type of object is the accumulator? The answer tells you how to set its initial value.
  • Where should the accumulator be initialized? Before, in, or after the loop?
  • What string member function lets you produce a tweaked version of its string that replaces "s" ' s with nothing? And what is nothining in this case?
  • What list member function allows you to append an element to its list?

Solution requirement

Two sample program runs

Enter text: susie sells seashells by the seashore

['susie', 'sells', 'seashells', 'by', 'the', 'seashore']

['uie', 'ell', 'eahell', 'by', 'the', 'eahore']

['susie', 'sells', 'seashells', 'by', 'the', 'seashore']

Enter text: sleepless in Seattle

['sleepless', 'in', 'Seattle']

['leeple', 'in', 'Seattle']

['sleepless', 'in', 'Seattle']

 


 

 

 
   
   
   
 
  © 2019 Jim Cohoon   Resources from previous semesters are available.