Here is my simple solution with Python:
def add(num1, num2): num_string1 = str(num1) num_string2 = str(num2) is_done = False if len(num_string1) > len(num_string2): length = len(num_string1) - len(num_string2) num_string2 = '0' * length + num_string2 is_done = True if len(num_string1) < len(num_string2) and is_done is False: length = len(num_string2) - len(num_string1) num_string1= '0' * length + num_string1 ans = '' index = 0 while index < len(num_string1): ans += str(int(num_string1[index]) + int(num_string2[index])) index += 1 return int(ans)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here is my simple solution with Python: