Notebook
for x in array: if x < pivot: less.append(x) else: greater.append(x)for x in array { if x < pivot { less.append(x) } else { greater.append(x) } }for x in array { if x < pivot { less.append(x) } else { greater.append(x) } }a = 5; b = 6; c = 7
In [1]: a = 'foo' In [2]: a.<Tab> a.capitalize a.format a.isupper a.rindex a.strip a.center a.index a.join a.rjust a.swapcase a.count a.isalnum a.ljust a.rpartition a.title a.decode a.isalpha a.lower a.rsplit a.translate a.encode a.isdigit a.lstrip a.rstrip a.upper a.endswith a.islower a.partition a.split a.zfill a.expandtabs a.isspace a.replace a.splitlines a.find a.istitle a.rfind a.startswith>>> getattr(a, 'split') <function split>
if not isinstance(x, list) and isiterable(x): x = list(x)
tmp = a a = b b = tmpb, a = a, b seq = [(1, 2, 3), (4, 5, 6), (7, 8, 9)] for a, b, c in seq: pass
by_letter.setdefault(letter, []).append(word)
loc_mapping = dict((val, idx) for idx, val in enumerate(strings)}
def make_counter(): count = [0] def counter(): # increment and return the current count count[0] += 1 return count[0] return counter counter = make_counter()