EXPLAIN THE BELOW PYTHON AND DBMS CODE STEP BY STEP WITH TERMINOLOGY

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 3RP
icon
Related questions
Question

EXPLAIN THE BELOW PYTHON AND DBMS CODE STEP BY STEP WITH TERMINOLOGY

import os
import platform
import mysql.connector
import pandas as pd
import datetime
mydb = mysql.connector.connect(user='root', password='Arun@102003',
host='localhost',
database='food')
mycursor=mydb.cursor()

def MenuSet(): #Function Food Booking System
    print("Enter 1 : To Add Cutomer details")
    print("Enter 2 : For Food Order")
    print("Enter 3 : Exit")
    try:      #Using Exceptions For Validation
        userInput = int(input("Please Select An Above Option: ")) #Will Take Input From User
    except ValueError:
        exit("\nHy! That's Not A Number") #Error Message
    else:
        print("\n") #Print New Line
    if(userInput == 1):
        Customer()
    elif (userInput==2):
        orderitem()
    elif (userInput==3):
        Food()
    elif (userInput==4):
        OrderFood()
    elif (userInput==5):
        View()
    else:
        print("Enter correct choice. . . ")

MenuSet()

def Customer():
    L=[]
    c_name=input("Enter the Customer Name: ")
    L.append(c_name)
    cphone=input("Enter customer phone number : ")
    L.append(cphone)
    email=input("Enter the email id:")
    L.append(email)
    OrderF_id=input("enter orderid:")
    L.append(OrderF_id)
    cust=(L)
    sql="insert into customer (c_name,cphone,email,OrderF_id) values (%s,%s,%s,%s)"
    mycursor.execute(sql,cust)
    mydb.commit()

def orderitem():
    print("Do yoy want to see menu available : Enter 1 for yes :")
    ch=int(input("enter your choice:"))
    if ch==1:
        print("\n")
        sql="select * from food"
        mycursor.execute(sql)
        rows=mycursor.fetchall()
        print("Food_id     Item      price")
        print("-------     -----     ------")
        for x in rows:
            print(x)
        print("do you want to purchase from above list:enter your choice:")
        d=int(input("enter your choice:"))
        if(d==1):
            print("you have ordered Gobi Manchurian")
            a=int(input("enter quantity: "))
            s=220*a
            
            print("your amount for Gobi Manchurian is :",s,"\n")
            
        elif (d==2):
            print("you have ordered Mushroom Chilli")
            a=int(input("enter quantity: "))
            s=260*a
            print("your amount for Mushroom Chilli is :",s,"\n")
        elif(d==3):
            print("you have ordered Paneer 65")
            a=int(input("enter quantity: "))
            s=250*a
            print("your amount for Paneer 65 is :",s,"\n")
        elif(d==4):
            print("you have ordered Schezwan Baby Corn")
            a=int(input("enter quantity: "))
            s=270*a
            print("your amount for Schezwan Baby Corn is :",s,"\n")
        elif(d==5):
            print("you have ordered Butter Naan")
            a=int(input("enter quantity: "))
            s=50*a
            print("your amount for Butter Naan is :",s,"\n")
        elif(d==6):
            print("you have ordered Onion Kulcha")
            a=int(input("enter quantity: "))
            s=75*a
            print("your amount for Onion Kulcha is :",s,"\n")
        elif(d==7):
            print("you have ordered Pulkha")
            a=int(input("enter quantity: "))
            s=25*a
            print("your amount for Pulkha is :",s,"\n")
        elif(d==8):
            print("you have ordered Stuffed Kulcha")
            a=int(input("enter quantity: "))
            s=75*a
            print("your amount for Stuffed Kulcha is :",s,"\n")
        elif(d==9):
            print("you have ordered Kaju Curry")
            a=int(input("enter quantity: "))
            s=220*a
            print("your amount for Kaju Curry is :",s,"\n")
        elif(d==10):
            print("you have ordered Paneer Butter Masala")
            a=int(input("enter quantity: "))
            s=220*a
            print("your amount Paneer Butter Masala is :",s,"\n")
        elif(d==11):
            print("you have ordered Gobi Rice")
            a=int(input("enter quantity: "))
            s=140*a
            print("your amount Gobi Rice is :",s,"\n")
        elif(d==12):
            print("you have ordered Veg Fried Rice")
            a=int(input("enter quantity: "))
            s=120*a
            print("your amount Veg Fried Rice is :",s,"\n")
        elif(d==13):
            print("you have ordered Kaju Rice")
            a=int(input("enter quantity: "))
            s=160*a
            print("your amount Kaju Rice is :",s,"\n")
        elif(d==14):
            print("you have ordered Veg Biryani")
            a=int(input("enter quantity: "))
            s=150*a
            print("your amount Veg Biryani is :",s,"\n")
        else:
            print("please enter your choice from the menu")
            
def runagain():
    runagn=input("\n You want to order anything else y/n:")
    while(runagn.lower()=='y'):
        if(platform.system()=="windows"):
            p=0
        else:
            orderitem()
        runagn=input("\n want to run again y/n:")
runagain()

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning