Ctrl K

Every-Other-Digit Sums

Easy
You get a string digits made of decimal digits. Add up the digits at even positions (0, 2, 4, …) and, separately, the digits at odd positions (1, 3, 5, …). Return True if the two sums are equal, and False otherwise.
Example 1
digits="3825" → False

Even positions give 3 + 2 = 5 and odd positions give 8 + 5 = 13, so the sums differ.

Example 2
digits="2783" → True

Even positions: 2 + 8 = 10; odd positions: 7 + 3 = 10. The sums match.

Example 3
digits="00" → True
Constraints
  • 2 ≤ len(digits) ≤ 100
  • digits contains digits only
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsValue of a Roman Numeral EasyShared Start of Words EasyBracket Balance EasyWhere the Fragment Starts EasyLength of the Final Word Easy
loading Python…
Input
digits="3825"
Expected
False

Run checks the first 3 tests in your browser. Submit checks all 106 tests on the server, hidden ones included.