CS5nm, UC Santa Barbara, Fall 2008         ex13, In Class Exercise, 11/12/2008

Name __________________________________________________________________

UMail Address: ____________________________________________ @ umail.ucsb.edu

This in-class exercise reviews slicing with strings (Section 3.4), lists (Section 10.5), and tuples (Section 12.1)

On this exercise, you may collaborate with others in answering these questions.

Fill in each of the blanks with what the output will be at the Python shell prompt.

>>> toppings = ["Cheese","Pepperoni","Mushrooms","Peppers"]
>>> sodas = ("Coke","Sprite","Pepsi","Root Beer")
>>> team = "Gauchos"
>>> team[0]
'G'
>>> team[-1]
's'
>>> team[1:]
__________
>>> team[2:4]
_________
>>> team[2:3]

_________
>>> team[2:2]

_________
>>> toppings[3]

_________
>>> toppings[3:]

_________
>>> toppings[:2]

_________

>>> sodas[2:3]

_________
>>> sodas[1:]

_________
>>> sodas[0]

_________
>>>