CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: String similarity Open both answers

Possible Plagiarism

Reposted on 2025-07-28
by Bending Rodriguez

Original Post

Original - Posted on 2025-06-11
by Bending Rodriguez



            
Present in both answers; Present only in the new answer; Present only in the old answer;

You can create a sqlite database to store your points in:

``` import sqlite3 connection = sqlite3.connect("game.db") cursor = connection.cursor()
cursor.execute(""" DROP TABLE IF EXISTS scoretable """) cursor.execute(""" CREATE TABLE IF NOT EXISTS scoretable ( playername TEXT NOT NULL, score INTEGER NOT NULL ) """)
connection.commit() connection.close() ``` this will create a basic table storing players names and their score.

``` playername = input("Type in playername: ") # If player is new a new row is added to the db newgame = input("Newgame? yes or no? ") if newgame == "yes": cursor.execute("INSERT INTO scoretable (playername,score) VALUES (?,?)", (playername,1)) # reads current players score from the db cursor.execute("SELECT score FROM scoretable WHERE playername = ?", [playername]) result = cursor.fetchone() a = result[0] print(a) b = input("c or d") if b == "c": a += 1 if b == "d": a -= 1 print(f"you have {a} points") # stores current players score in the db cursor.execute("UPDATE scoretable set score = ? WHERE playername = ?", (a,playername)) connection.commit() connection.close() ``` I have added some basic storing points mechanics to your game. This is only a starting point as you could flesh this out way further.
You can create a sqlite database to store your points in:

``` import sqlite3 connection = sqlite3.connect("game.db") cursor = connection.cursor()
cursor.execute(""" DROP TABLE IF EXISTS scoretable """) cursor.execute(""" CREATE TABLE IF NOT EXISTS scoretable ( playername TEXT NOT NULL, score INTEGER NOT NULL ) """)
connection.commit() connection.close() ``` this will create a basic table storing players names and their score.

``` playername = input("Type in playername: ") # If player is new a new row is added to the db newgame = input("Newgame? yes or no? ") if newgame == "yes": cursor.execute("INSERT INTO scoretable (playername,score) VALUES (?,?)", (playername,1)) # reads current players score from the db cursor.execute("SELECT score FROM scoretable WHERE playername = ?", [playername]) result = cursor.fetchone() a = result[0] print(a) b = input("c or d") if b == "c": a += 1 if b == "d": a -= 1 print(f"you have {a} points") # stores current players score in the db cursor.execute("UPDATE scoretable set score = ? WHERE playername = ?", (a,playername)) connection.commit() connection.close() ``` I have added some basic storing points mechanics to your game. This is only a starting point as you could flesh this out way further.

        
Present in both answers; Present only in the new answer; Present only in the old answer;