Show Menu
Cheatography

SI 106 Final Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Methods

string.co­unt()
returns number of times a value occurs in a string
string.in­dex()
returns index of given value
s.join()
joins elements in an iterable by the provided string
s.repl­ace­(ol­d,new)
replaces all occurences of the substring with new substring
s.split()
splits string at given sub, returns list
s.upper()
uppercase
L.append()
adds item to END of list
L.copy()
returns copy of List
L.count()
returns count of elements
L.index()
returns index of first occurence
L.inse­rt(­Idx­,value)
inserts value at that index, nothing removed
L.pop(Idx)
removes item at index
L.remo­ve(­value)
removes first occurence of value
L.reve­rse()
reverses order of list
L.sort()
sorts list alphab­eti­cally
D.clear()
makes given D empty
D.copy()
returns copy of D
D.get(key)
returns value of key
D.items()
returns list of tuple of D(K,V)
D.keys()
returns list of keys
D.values()
returns list of values

Functions

adding () will call the function
print(­lambda x:x) prints the type function
Passing mutable objects into functions will mutate that object for future uses