Convert to string to get sum of the cubes of its digits
string = str ( N ) NEW_LINE sum = 0 NEW_LINE for i in range ( len ( string ) ) : NEW_LINE INDENT val = int ( ord ( string [ i ] ) - ord ( '0' ) ) NEW_LINE sum += val * val * val NEW_LINE DEDENT