← Back to challenges

Are the Sum of Digits in the Numbers Equal?

PythonHardarrayslanguage_fundamentalsvalidationconditions

Instructions

Write a function that takes a list of two numbers and determines if the sum of the digits in each number are equal to each other.

Examples

is_equal([105, 42]) ➞ True
# 1 + 0 + 5 = 6
# 4 + 2 = 6

is_equal([21, 35]) ➞ False

is_equal([0, 0]) ➞ True

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Diagonal of a Cube