Home Coding Data Structure – Lists 02

Data Structure – Lists 02

0
Data Structure – Lists 02

# Lists methods and function
# We will see some of the most used method and function for lists
# We will see: 
# sort(), append(), len(list), count(), insert(), pop(), 
# index(), remove(), reverse(), extend(), max(list),
# min(list), clear(), copy(), type(list)
#
# APPEND - EXTEND - SORT - COPY

# I'm an empty list. 
list1 = []

#just add some items, one by one
list1.append(6)
list1.append(7)
list1.append(9)

# and then add a group of items
list1.extend([8,12,0,25])

#copy list1 in list2
list2 = list1.copy()

#and sort it
list1.sort()

# copy www.AEC.codes
OUT = (list1, list2)