Question: Please fill in the following Python code below, with the answers in correlation with the database and Questions in the provided images Python Code: import
Please fill in the following Python code below, with the answers in correlation with the database and Questions in the provided images
Python Code:
import sqlite
from sqlite import Error
def openConnectiondbFile:
print
printOpen database: dbFile
conn None
try:
conn sqliteconnectdbFile
printsuccess
except Error as e:
printe
print
return conn
def closeConnectionconn, dbFile:
print
printClose database: dbFile
try:
conn.close
printsuccess
except Error as e:
printe
print
def createTableconn:
print
printCreate table"
print
def dropTableconn:
print
printDrop tables"
print
def populateTableconn:
print
printPopulate table"
print
def Qconn:
print
printQ
try:
output openoutputout', w
sql conn.executeSELECT FROM warehouse"
table sqlfetchall
header :::::
outputwriteheaderformatwId "wName", "wCap", "sId", "nId"
for i in range lentable:
outputwriteheaderformatstrtablei strtablei strtablei strtablei strtablei
outputclose
except Error as e:
printe
print
def Qconn:
print
printQ
try:
output openoutputout', w
header :::
outputwriteheaderformatnation "numW", "totCap"
outputclose
except Error as e:
printe
print
def Qconn:
print
printQ
try:
input openinputinr
nation input.readlinestrip
inputclose
output openoutputout', w
header :::
outputwriteheaderformatsupplier "nation", "warehouse"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
