MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / save_score

Function save_score

projects/Quiz Game/main.py:17–26  ·  view source on GitHub ↗

Save the player's score to the database

(conn, name, score)

Source from the content-addressed store, hash-verified

15
16# store the player's score with their name
17def save_score(conn, name, score):
18 """
19 Save the player's score to the database
20 """
21 sql = """ INSERT INTO scores(name, score)
22 VALUES(?,?) """
23 cur = conn.cursor()
24 cur.execute(sql, (name, score))
25 conn.commit()
26 return cur.lastrowid
27
28
29# recall the previous scores to display them

Callers 1

main.pyFile · 0.70

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected