Skip to content

Instantly share code, notes, and snippets.

@MichaelSDavid
Created September 9, 2020 02:02
Show Gist options
  • Save MichaelSDavid/21b0fa0deba4d6252ae21f24b0c3c4b9 to your computer and use it in GitHub Desktop.
Save MichaelSDavid/21b0fa0deba4d6252ae21f24b0c3c4b9 to your computer and use it in GitHub Desktop.
Challenge #18 solution for TWT Discord
# 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