Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # adding new data to database
- import sqlite3 # get the module
- conn = sqlite3.connect("computer_cards.db") #connect to the databse
- #function to add new cards
- def addnew(name, cores, cpu_speed, ram, cost):
- insert_sql = "insert into computer(name, cores, cpu_speed, ram, cost) values ('{}', {}, {}, {}, {})".format(name, cores, cpu_speed, ram, cost)
- conn.execute(insert_sql)
- conn.commit()
- print("Add a new card")
- entname = input("Name >> ")
- entcores = input("Cores >> ")
- entcpu_speed = input("CPU speed >> ")
- entram = input ("RAM >> ")
- entcost = input ("Cost >> ")
- addnew(entname, entcores, entcpu_speed, entram, entcost)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement