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()
- print("Enter the details:")
- name = input("Name > ")
- cores = input("Cores > ")
- cpu_speed= float(input("CPU Speed in GHz> "))
- ram= input("RAM in GB > ")
- cost= input("Cost in € > ")
- 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