online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
def removeEmpties(lol): colsCnt = len(lol[0]) emptyRow = [None]*colsCnt # first remove all rows containing only None elements lol2 = list(lst for lst in lol if lst!=emptyRow) # second go through by columm for col in range(colsCnt-1,-1,-1): # and now look at that column in every row for row in lol2: # if an element in the current row is not None in that column if row[col] is not None: # we do not need to look any further, # since this column has to remain break; else: # if we could not find any non-None element, # this column must be removed from all rows. for row in lol2: del row[col] return lol2 print(removeEmpties([['a' ,None,'c' ], [None,None,None], ['g' ,None,'i' ], ['j' ,None,None]])) print(removeEmpties([['a' ,None,'c' ], [None,None,None], ['g' ,None,'i' ], ['j' ,None,'None']]))

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue