online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
# compute score for input string def get_score( s ): if 'NAV' in s: return 0 grade_table = { 'A': 1, 'B': 2, 'C': 2, 'D' : 3} score = 0 for idx, grade in enumerate(grade_table.keys()): score += s.count( grade ) * grade_table[grade] return score if __name__ == '__main__': list_test = ['1A', '7A', '7A-1A', '1A-7A', '1C', '3D', '3B', '3A-7B', '1A-28A-3A', '20A-7A-3A', '28A-7A-3A-1A', '7A-3A-1A-28A', '1A-7C-3A', '7B-3A-1A', '3C-7A', '7B-3NAV', '3B-7NAV', '20-7', '7'] score_group = [None] * 5 # create score group from 0 to 4 for wanted_score in range(0,5): score_group[wanted_score] = list( filter (lambda x: (get_score(x) == wanted_score), list_test) ) # output score group from 0 to 4 for s, g in enumerate(score_group): print( "{score} score list: {group}".format( score = s, group = g) )

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