Insert an item at a given position. The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x).
Back
list.extend(L)
Front
extend list by adding all items in given list
Back
end=' ' in print statements
Front
keeps it all on the same line
Back
string literal has
Front
quotes
Back
2 + 3.0 returns a
Front
float type
Back
strings are immutable meaning
Front
they can't be changed
Back
list.index(x)
Front
Return the index in the list of the first item whose value is x. It is an error if there is no such item.
Back
range(0,10,3) produces
Front
[0,3,6,9]
Back
list.reverse()
Front
reverses the order of the elements in the list
Back
to change a string ie make it capital you have to
Front
create a new string
Back
tuple is a list that can not be
Front
changed
Back
len() finds
Front
length of string
Back
To iterate over the indices of a sequence, you can combine range() and len() as follows:
Front
for I in range(Len(a)):
print(I,a[I])
Back
list.pop([i])
Front
Deletes the ith element in the list and returns its value
Back
list.append(x)
Front
adds item to end of list
Back
list.remove(x)
Front
remove first item in list whose value is x
Back
converting float to int -->
Front
truncates the float into integer
Back
print('1 2 3')
output
Front
1
2
3
Back
a dictionary captures
Front
relationships between elements
ie names and ages
Back
you can't use equality operators to compare what data type?
Front
floating point
ie you can't say x = 4.35
Back
floating point literal includes the
Front
decimal
ie 1.0
3.0
Back
list can contain
Front
different elements
ie 2, 'e', 3
Back
input() inherent data type is a
Front
string
Back
list.sort
Front
Sorts all the items and updates the list at the same time