Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Created September 4, 2025 19:08
Show Gist options
  • Save pythoninthegrass/94b40f81428acb17e538cd6735cd2efd to your computer and use it in GitHub Desktop.
Save pythoninthegrass/94b40f81428acb17e538cd6735cd2efd to your computer and use it in GitHub Desktop.
codingame.com - sum of squared numbers
"""
INPUT:
Line 1: An integer N for the amount of numbers to use.
Line 2: A line containing N space-separated integers Xi.
OUTPUT:
The sum of the squares of the Xi numbers.
CONSTRAINTS:
0 < N < 100
-1000 < Xi < 1000
Input | Output
--------|-------
3 | 14
1 2 3 | 1 4 9
"""
n = int('3')
sum_of_squares = 0
for i in '1 2 3'.split():
xi = int(i)
sum_of_squares += xi**2
print(sum_of_squares)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment