Compsci 06/101, Fall 2011, Lab 3

By entering your name/net-id below you indicate you are present for Lab 2 to answer these questions and that you were part of the process that resulted in answers being turned in.

Name: ______________    Net id: _____________ || Name: ______________    Net id: _____________

Name: ______________    Net id: _____________ || Name: ______________    Net id: _____________

String Slicing and Dicing

Provide your answers to 3-7, creating each word by slicing:

  1. 
    
    

  2. 
    
    

  3. 
    
    

  4. 
    
    

Create your own slicing/word puzzle: what's the word and what is the answer?





Vocabulary

  1. What do you think the name of the string method is that returns the lowercase version of a string?
  2. 
    
    

  3. The function max returns the maximal value of a string as well as a list. What is max("science") and why?
  4. 
    
    

  5. What is the value of reversed(sorted([5,4,1,2,8])) and why?
  6. 
    
    

  7. What is the value of sorted(lst).index(min(lst)) for any list lst? Why? What's the value if min is replaced by max?
  8. 
    
    

  9. Why is the value of st.endswith(st[-3:]) guaranteed to always be true?
  10. 
    
    

  11. When is the value of st.upper().endswith(st) true?