Odd Position Sum

ABC 403

Problem 13 of 50

Easy

What to do

Given a list of integers, calculate the sum of elements at odd positions (1st, 3rd, 5th, etc. using 1-based indexing). For example, in [3, 1, 4, 1, 5], the elements at positions 1, 3, 5 are 3, 4, 5, so the sum is 12.

Key Concepts

lists loops basic math input/output

Examples

Input: arr = [3, 1, 4, 1, 5, 9, 2]

Output: 14

Input: arr = [100]

Output: 100

Tips for Beginners

  • Focus on understanding the logic, not memorizing syntax
  • Use print statements to debug your code
  • Don't worry about input parsing - the function handles that for you
  • If stuck, try writing out your solution on paper first

Python Editor

Loading Python...