Difference between revisions of "Object and Data Structure Basics"
Jump to navigation
Jump to search
(Created page with "''List'' mylist= ['string', 1,2,3]") |
|||
Line 1: | Line 1: | ||
==List== | |||
mylist= ['string', 1,2,3] | mylist= ['string', 1,2,3] | ||
len(mylist) # get length of list | |||
Result 3 | |||
Get part of a list (Slicing) | |||
mylist[1:] gets from index one to the end | |||
result 1,2,3 | |||
Concatenate list | |||
another_list = [5,6] | |||
mylist + anohter_list | |||
result ['string', 1,2,3,5,6] |
Revision as of 21:19, 2 January 2019
List
mylist= ['string', 1,2,3] len(mylist) # get length of list Result 3
Get part of a list (Slicing)
mylist[1:] gets from index one to the end result 1,2,3
Concatenate list
another_list = [5,6] mylist + anohter_list result ['string', 1,2,3,5,6]