Search
Browse
Create
Log in
Sign up
Log in
Sign up
Upgrade to remove ads
Only $0.99/month
Python List Operations
STUDY
Flashcards
Learn
Write
Spell
Test
PLAY
Match
Gravity
Terms in this set (27)
Operation
Result Notes
s[i] = x
item i of s is replaced by x
s[i:j] = t
slice of s from i to j is replaced by the contents of the iterable t
del s[i:j]
same as s[i:j] = []
s[i:j:k] = t
the elements of s[i:j:k] are replaced by those of t (1)
del s[i:j:k]
removes the elements of s[i:j:k] from the list
s.append(x)
same as s[len(s):len(s)] = [x] (2)
s.extend(x)
same as s[len(s):len(s)] = x (3)
s.count(x)
return number of i's for which s[i] == x
s.index(x[, i[, j]])
return smallest k such that s[k] == x and i <= k < j (4)
s.insert(i, x)
same as s[i:i] = [x] (5)
s.pop([i])
same as x = s[i]; del s[i]; return x (6)
s.remove(x)
same as del s[s.index(x)] (4)
s.reverse()
reverses the items of s in place (7)
s.sort([cmp[, key[, reverse]]])
sort the items of s in place
x in s
True if an item of s is equal to x, else False (1)
x not in s
False if an item of s is equal to x, else True (1)
s + t
the concatenation of s and t (6)
s
n, n
s
n shallow copies of s concatenated (2)
s[i]
ith item of s, origin 0 (3)
s[i:j]
slice of s from i to j (3)(4)
s[i:j:k]
slice of s from i to j with step k (3)(5)
len(s)
length of s
min(s)
smallest item of s
max(s)
largest item of s
s.index(x)
index of the first occurrence of x in s
s.count(x)
total number of occurrences of x in s
THIS SET IS OFTEN IN FOLDERS WITH...
Basic Terminal Commands
22 terms
Python Escape Sequences
15 terms
Python File Commands
5 terms
Python Function Checklist
12 terms
YOU MIGHT ALSO LIKE...
CISC 192 - MyProgrammingLab - Chapter 20
32 terms
Java Code (CodingBat) Array-1
27 terms
My Programming Lab - Ch19
16 terms
Java 2 FINAL EXAM
100 terms
OTHER SETS BY THIS CREATOR
Chapter 13
37 terms
دوباره با تو 7
172 terms
دوباره با تو 6
150 terms
دوباره با تو 5
149 terms