CS 61A Lecture 10
CS 61A Lecture 10
Announcements
Announcements
Lists ['Demo']
Lists ['Demo']
Working with Lists
Working with Lists 4
Working with Lists >>digits=[1,8,2,8] n
Working with Lists >>> digits = [1, 8, 2, 8] 4
Working with Lists >>digits=[1,8,2,8] >>dig1ts=[2//2,2+2+2+2,2,2*2*2] n
Working with Lists >>> digits = [1, 8, 2, 8] 4 >>> digits = [2//2, 2+2+2+2, 2, 2*2*2]
Working with Lists >digits=[1,8,2,8] >>dig1ts=[2//2,2+2+2+2,2,2*2*2] The number of elements
Working with Lists >>> digits = [1, 8, 2, 8] 4 The number of elements >>> digits = [2//2, 2+2+2+2, 2, 2*2*2]
Working with Lists >>digits=[1,8,2,8] >>dig1ts=[2//2,2+2+2+2,2,2*2*2] The number of elements >>>len(digits)
Working with Lists >>> digits = [1, 8, 2, 8] 4 The number of elements >>> len(digits) 4 >>> digits = [2//2, 2+2+2+2, 2, 2*2*2]
Working with Lists >digits=[1,8,2,8] >>dig1ts=[2//2,2+2+2+2,2,2*2*2] The number of elements >>>len(digits) 4 An element selected by its index
Working with Lists >>> digits = [1, 8, 2, 8] 4 The number of elements >>> len(digits) 4 An element selected by its index >>> digits = [2//2, 2+2+2+2, 2, 2*2*2]
Working with Lists >>digits=[1,8,2,8] >>dig1ts=[2//2,2+2+2+2,2,2*2*2] The number of elements >>>len(digits) An element selected by its index >>digits[3] 8
Working with Lists >>> digits = [1, 8, 2, 8] 4 The number of elements >>> len(digits) 4 An element selected by its index >>> digits[3] 8 >>> digits = [2//2, 2+2+2+2, 2, 2*2*2]