If the current digit is not already 0 then update it to 0 and decrement k
if num [ i ] != '0' : NEW_LINE INDENT num = num [ : i ] + '0' + num [ i + 1 : ] NEW_LINE k -= 1 NEW_LINE DEDENT i += 1 NEW_LINE