Skip to content

Instantly share code, notes, and snippets.

@downloadpizza
Last active September 10, 2018 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save downloadpizza/fae51561bc5d42d190108d90e60aac7d to your computer and use it in GitHub Desktop.
Save downloadpizza/fae51561bc5d42d190108d90e60aac7d to your computer and use it in GitHub Desktop.
Eine Python Lösung für coding challenge 7
import requests
import json
def fsum(ls,rs):
for a in range(0,len(ls)):
for b in range(a, len(ls)):
for c in range(b, len(ls)):
for d in range(c, len(ls)):
if ls[a]+ls[b]+ls[c]+ls[d]==rs:
return [a,b,c,d]
chall = "https://cc.the-morpheus.de/challenges/8/"
solut = "https://cc.the-morpheus.de/solutions/8/"
getr = json.loads(requests.get(chall).text)
arr = json.dumps({"token":fsum(getr["list"], getr["k"])})
print(arr)
print(requests.post(solut, arr).text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment