what is a tuple
immutable list
list all access types for file we learnes
r-read
w-write
a-append
wb- write binary
rb- read binary
how to add to dictionary?
dictionary_name[key]=[value]
F
in try and except what except statements did we learn
except IOError, ValueError, IndexError, and generalized error
what is purpose of dictionary
to assign values by keys not indexes
What is outfile vs infile
outfile- sends to another file on computer
infile- does in program
how to retrieve all keys from dictionary
dict.keys()
how do you call function
function_name()
in the random function which different ways did we incorporate the module
random.randint(lower, upper) #inclusive
random.randrange(lower, upper, step)
random.random() any #
how to initialize dictionary
{}
how to put full list into text
outfile.writelines('filename')
how to remove key form dictionary
dict.pop(key) or dict.popitem #last item
how to define a function
def function_name(any local variables):
set up a matrix
matrix = [
[x,y]
[z,a]
]
how to initialize list
brackets
What would you do to read whole document as a str vs lines as a str
__file.readlines('filename') # read lines
__file.reader('filename') # whole document
how to specific value out of dictionary
dict.get(key)
different ways we incorporated os function
os.rename('oldname', 'newname')
os.remove('filename')
how to write all lines in a file using an the in function
for items in 'file.csv'
outfile.write(item)
how to initialize tuple
()
what would you do to read an excel file and add delimiters
in dictionaries what data types can be used for keys and values
any!
how to print statements from function
return variable1, variable2, variable3 #inside function
obj1, obj2, ob3 = function_name() #outside function
how to do reverse alphabetical on a list
list.sort(reverse=True)