# https://www.w3schools.com/python/python_ref_list.asp # https://www.quackit.com/python/reference/python_3_list_methods.cfm programMessage = ''' A deep copy is a new copy of an existing object. This copy demonstrates this principle. 1.) Create a list. 2.) Create a new copy from the original list. 3.) Show the id's of the objects are the different. 4.) Append a value to basicList then show the copy in myList has not changed. ''' print(programMessage) basicList = [1, 34, 99, 87, 14] print(f"Before copy {basicList}") myList = basicList.copy() print(f"After copy {basicList} ==> {myList}") print(f"After copy {id(basicList)} <= Not Equal => {id(myList)}") print("\n") print("Append a value to basicList. Examine any changes to myList\n") #basicList = [1, 34, 99, 87, 14] #myList = basicList.copy() print(f"Before append to basicList {basicList}") basicList.append(777) print(f"basicList - After append {basicList}") print(f"myList - After append {myList}") print(f"After append {id(basicList)} <= Not Equal => {id(myList)}")