Created
September 9, 2020 02:02
-
-
Save MichaelSDavid/21b0fa0deba4d6252ae21f24b0c3c4b9 to your computer and use it in GitHub Desktop.
Challenge #18 solution for TWT Discord
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Only requires the function for submission | |
def solution(k): | |
r,y = [],[] | |
m = 1 | |
while m <= k: | |
if m % 2 == 0: | |
r.append(m ** 2) | |
else: | |
y.append(m ** 2) | |
m += 1 | |
return sum(r) - sum(y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment