Question: 
Write a function to divide a number into two parts such that the sum of digits is maximum.


Model's Code:
def sum_digits_twoparts(n):
    s = str(n)
    max_sum = 0
    
    for i in range(1, len(s)):
        part1 = int(s[:i])
        part2 = int(s[i:])
        digit_sum = sum(int(digit) for digit in str(part1)) + sum(int(digit) for digit in str(part2))
        max_sum = max(max_sum, digit_sum)
    
    return max_sum



Sample Correct Code:
def sum_digits_single(x) : 
    ans = 0
    while x : 
        ans += x % 10
        x //= 10  
    return ans 
def closest(x) : 
    ans = 0
    while (ans * 10 + 9 <= x) : 
        ans = ans * 10 + 9  
    return ans   
def sum_digits_twoparts(N) : 
    A = closest(N)  
    return sum_digits_single(A) + sum_digits_single(N - A) 


Asserts:
assert sum_digits_twoparts(35)==17
assert sum_digits_twoparts(7)==7
assert sum_digits_twoparts(100)==19


Tests:
Test 1 of 3: FAIL: AssertionError()

Test 148 of 974: 106/148 (71.62162162162163%): failed