python 10-18-17.py - #Lists are mutable: list1 =...

This preview shows page 1 - 3 out of 4 pages.

##Lists are mutable:list1 = [1,2,3,4,5]print("list1 before change: ", list1)list1[0] = 99print("list1 after change: ", list1)##======== RESTART: /Users/kimberlynguyen/Documents/python 10-18-17.py ========##list1 before change:[1, 2, 3, 4, 5]##list1 after change:[99, 2, 3, 4, 5]##>>>##Fill a list with values using index:##- first you create a list##- then fill in the listlist1 = [0] *5#initializing the listprint("list1 before filling in the list: ", list1)index = 0#filling the listwhile index < len(list1):list1[index] = 99index = index + 1456
##-7-6-5-4-3-2-1days = ['Sun', 'Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat']mid_days = days[2:5]

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 4 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
LOKE

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture