Save the player's score to the database
(conn, name, score)
| 15 | |
| 16 | # store the player's score with their name |
| 17 | def 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 |