Program - All blank lists are not the same


Topic: Program - All blank lists are not the same

Solution

a_list = []
print(a_list, '\nID (initial):',id(a_list), '\n')
a_list.append(1)
print(a_list, '\nID (append):',id(a_list), '\n')
a_list.extend([2])
print(a_list, '\nID (extend):',id(a_list))



List all Python Programs