[Solved]Python Import Sqlite3 Conn Sqlite3connect Osemployeedb Conn Cur Conncursor Try Take User I Q37045171
Python:

import sqlite3
conn = sqlite3.connect(“OS_Employee.db”)
with conn:
cur = conn.cursor()
try:
# Take user input for Employee_ID. Error checks it. Makes sure it’snot taken.
EmployeeID = input(“Please enter a employee ID: “)
First_Name = input(“Please enter the employee’s first name:”)
Last_Name = input(“Please enter the employee’s last name: “)
Email = input(“Please enter the employee’s email: “)
Password = input(“Please enter a password: “)
cur.execute(“””INSERT INTO Employee VALUES (Employee_ID,First_Name,
Last_Name, Email, Password)”””)
New_User = “INSERT INTO Employee VALUES (‘{}’, ‘{}’, ‘{}’, ‘{}’,'{}’)”.format(EmployeeID, First_Name, Last_Name, Email,Password)
cur.execute(New_User)
cur.execute(“SELECT * FROM Employee WHERE(EmployeeID ='{}’)”.format(EmployeeID))
results = cur.fetchone()
print(results)
except Exception as e:
print(“Connection Failed ” + str(e))
conn.close()
I need help with finding what is the problem with the code. Asyou can see when I try to register a new person to the database, itgives an error code:
“Connection Failed no such table: Employee”
#1 /usr/bin/env # python3 utf-8 Name ▲ Type Value coding: -*- -*- Email george.cho@gmail.com 2256 George Cho george str import sqlite3 connsqlite3.connect(“OS_Employee.db”) Emp LoyeelD str with conn: First Name tr curconn.cursor() try: Last Name str i # Take user input for Employee-ID. Error checks it. Makes sure it’s not taken Password str EmployeeIDinput(“Please enter a employee ID: “) First Nameinput(“Please enter the employee’s first name: “) Last Nameinput(“Please enter the employee’s last name: ” Emailinput(“Please enter the employee’s email: “) Password = input (“Please enter a password: cur.execute(“””INSERT İNTO Employee VALUES Last Name, Email, Password)”””) (Employee-ID, First-Name, New_User”INSERT INTO Employee VALUES (,,, .format EmployeeID, F cur.execute(New _User) cur.execute( “SELECT FROM Employee WHERE(EmployeeID’).format (EmpLoyeeID)) results-cur.fetchone) print(results) Help Variable explorer except Exception as e: IPython console print(“Connection Failed “+ str(e)) conn.closet) Console 1/A Please enter a employee ID: 2256 Please enter the employee s first name: George Please enter the employee’s last name: Cho Please enter the employee’s email: george. choEgmail.com Please enter a password: george Connection Failed no such table: Employee Show transcribed image text #1 /usr/bin/env # python3 utf-8 Name ▲ Type Value coding: -*- -*- Email george.cho@gmail.com 2256 George Cho george str import sqlite3 connsqlite3.connect(“OS_Employee.db”) Emp LoyeelD str with conn: First Name tr curconn.cursor() try: Last Name str i # Take user input for Employee-ID. Error checks it. Makes sure it’s not taken Password str EmployeeIDinput(“Please enter a employee ID: “) First Nameinput(“Please enter the employee’s first name: “) Last Nameinput(“Please enter the employee’s last name: ” Emailinput(“Please enter the employee’s email: “) Password = input (“Please enter a password: cur.execute(“””INSERT İNTO Employee VALUES Last Name, Email, Password)”””) (Employee-ID, First-Name, New_User”INSERT INTO Employee VALUES (,,, .format EmployeeID, F cur.execute(New _User) cur.execute( “SELECT FROM Employee WHERE(EmployeeID’).format (EmpLoyeeID)) results-cur.fetchone) print(results) Help Variable explorer except Exception as e: IPython console print(“Connection Failed “+ str(e)) conn.closet) Console 1/A Please enter a employee ID: 2256 Please enter the employee s first name: George Please enter the employee’s last name: Cho Please enter the employee’s email: george. choEgmail.com Please enter a password: george Connection Failed no such table: Employee
Expert Answer
Answer to Python: import sqlite3 conn = sqlite3.connect(“OS_Employee.db”) with conn: cur = conn.cursor() try: # Take user input fo… . . .
OR

