def add_code_cell(cells, source):
    """Add a code cell containing `source` to the notebook."""
    from nbformat.v4.nbbase import new_code_cell
    n_code_cells = len([c for c in cells if c['cell_type'] == 'code'])
    cells.append(new_code_cell(source=source, execution_count=n_code_cells+1))
def add_code_cell ( cells , source ) : from nbformat . v4 . nbbase import new_code_cell n_code_cells = len ( [ c for c in cells if c [ 'cell_type' ] == 'code' ] ) cells . append ( new_code_cell ( source = source , execution_count = n_code_cells + 1 ) )
Add a code cell containing `source` to the notebook.