MCPcopy
hub / github.com/geekinglcq/CDCS / addSolutionInfo

Function addSolutionInfo

utility.py:7–21  ·  view source on GitHub ↗

Add one solution of a competition

(id)

Source from the content-addressed store, hash-verified

5
6
7def addSolutionInfo(id):
8 """
9 Add one solution of a competition
10 """
11 with codecs.open('solutions.json', 'r', encoding='utf-8') as f:
12 solutions = json.load(f)
13 if str(id) in solutions.keys():
14 print("ID exsited, please try again")
15 return
16 algo = input("Enter algorithm: ")
17 code = input("Enter code: ")
18 s = {"algorithm": algo, "code": code}
19 solutions[id] = s
20 with codecs.open("solutions.json", 'w', encoding='utf-8') as f:
21 json.dump(solutions, f, indent=4, ensure_ascii=False)
22
23
24def addCompe():

Callers 1

addCompeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected