Saint Louis University |
Computer Science 150
|
Dept. of Math & Computer Science |
Topic: Using list and str objects
Related Reading: Notes from class, and Chapter 4 of Zelle.
Due:
1:10pm, Monday 19 September 2005
Please make sure you adhere to the policies on academic integrity.
Given a string, declared as:
school = 'Saint Louis University'
What command, or series of commands, would allow you to print out
the substring 'Louis' based on use of the original string in this
specific example?
Assume that we have a list, initialized as:
fruits = ['apple','banana','cherry','grape','lime','orange','strawberry']
What command, or sequence of commands, could you use to alter
that list, replacing the occurrence of 'lime' with, in the same
place, the string 'kiwi'?
Assume that we have a list, fruits, which contains strings representing the names of various fruits. What command, or sequence of commands, could you use to produce a single string diet which would contains all of the fruits from the list, in order, and separated by a comma and a space.
As an example, if the list of fruits happened to be
fruit = ['apple','banana','cherry','grape','lime','orange','strawberry']
the resulting diet should have value:
'apple, banana, cherry, grape, lime, orange, strawberry'
However, your answer should not be designed solely for this one
example.
Assume that person is a reference to a string of the
general form
Assume that person is a reference to a string
of the form
For example if
TBA