Last active
September 10, 2018 06:49
-
-
Save downloadpizza/fae51561bc5d42d190108d90e60aac7d to your computer and use it in GitHub Desktop.
Eine Python Lösung für coding challenge 7
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
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