



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Today ...
Homework
Slices always return new (shallow copied) lists
list3 = [’a’, [’b’, ’c’], ’d’]
list4 = list3[1:3]
list [[’b’, ’c’], ’d’]
list4[0][1] = ’e’
list [[’b’, ’e’], ’d’]
list [’a’, [’b’, ’e’], ’d’]
This is also true of list concatenation
list5 = [1, [10, 100]]
list6 = list5 + [2]
list [1, [10, 100], 2]
list5[1][0] = 50
list [1, [50, 100]]
list [1, [50, 100], 2]
List Slice Exercises
Assume that:
my_str = "go bulldogs"
Define expressions that Use slices to generate the following strings:
What is a Boolean value?
Python has special Boolean values
type(True) <class ’bool’>
type(False) <class ’bool’>
A detail of Python bool values