Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- conn = sqlite3.connect("computer_cards.db")
- def create(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()
- create("My Computers", 4, 1, 4096, 55)
- print("Enter the details")
- name = input("Name >")
- cores = input("Cores >")
- cpu_speed = input("Speed >")
- ram = input("RAM >")
- cost = input("Cost >")
- create(name, cores, cpu_speed, ram, cost)
- result = conn.execute("Select * from computer")
- computers = result.fetchall()
- for computer in computers:
- print(computer)
- conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement