CMPT 120 Study Guide - Final Guide: List Of Order Structures In Mathematics, Linked List

82 views2 pages
meghan78 and 39786 others unlocked
CMPT 120 Full Course Notes
29
CMPT 120 Full Course Notes
Verified Note
29 documents

Document Summary

E. g. ) list_name = [ a", b", c", 1, 2, 3, 4] E. g. ) list_name [1:5], will return [b, c, 1, 2] (right before 5th element) E. g. ) list_name[2] = cmpt, then if print list_name[2]will return cmpt, not 2. First initiate the variable with a list object name, then use square brackets to store the values separated by commas. Use slicing on left-hand side of assignment operator: Use del statement (if you know which element you are deleting) or remove() (if you don"t know which element you are deleting): len([list]) - returns length of list, number of elements in list. [list1] + [list2] - concatenates two list into one, returns [list1, list2] E. g. ) del list_name[2] [ a", c", 1, 2, 3, 4] What is the different between append() and extend()? list(tuple) - converts tuple into a list. Append takes a argument that can be any data type and adds it to the end of a list.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers

Related Documents

Related Questions