Python Project

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 54

PYTHON PROGRAMMING

BESANT TECHNOLOGIES

PROJECT

ATM CONCEPT
COVID 19 MANAGEMENT SYSTEM
TRAVEL AGENCY CONCEPT

Batch No: 74
Full name: Balasastha. P
Mobile no: 9514281390
Alternate no: 9047417989
Email: balasastha1002@gmail.com
College name: Nehru institute of engineering and technology
Location: Coimbatore
ATM CONCEPT:
PROGRAM:
DATABASE CREATION:
import mysql.connector

db = mysql.connector.connect(
host="localhost",
user="root",
password="2001",
)

mycursor= db.cursor()
mycursor.execute("CREATE DATABASE ATM")
print("success")

OUTPUT:
DATABASE TABLE CREATION:
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="ATM"
)

#database creation
#connectionline
mycursor=mydb.cursor()
#************************************************

mycursor.execute("CREATE TABLE Accountdetails (Name varchar(255),Accountno


Bigint(15),Phoneno Bigint(20),Balance Bigint(20))")
print("Table created succesfully")

OUTPUT:
INSERTING VALUES INTO DATABASE:
import mysql.connector

mydb = mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="ATM"
)

mycursor = mydb.cursor()

sql = "INSERT INTO Accountdetails (Name,Accountno,Phoneno,Balance) VALUES


(%s,%s,%s,%s)"
val = [
('Peter', '456743257890', '9514281390','1000'),
('Amy','345632148976', '9047417989','10000'),
('Hannah','453265437865', '9976486470','100000')
]

mycursor.executemany(sql, val)

mydb.commit()

print(mycursor.rowcount, "record was inserted.")

OUTPUT:
Details inserted successfully
MAIN PROGRAM:
#Personal details
print("Name: Balasatha P")
print("Email: balasastha1002@gmail.com")
print("Phone no: 9514281390")
print("Batch: Python")
print("Batch no:74")

print("Welcome to BOI ATM")


print("\nPlease insert your card")
def views():
# connection lines
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="ATM"
)
mycursor=mydb.cursor()
#Get phone no
Phoneno=int(input("Enter Phone no: "))
mycursor.execute("select Phoneno from Accountdetails where
Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
#Choose the language
for x in myresult:
print ("Entered Phone no is:",*x,sep='')
print("\nSelect Language 1.English 2.Tamil")
Lan=int(input("Enter number: "))
if Lan==1:
#Generate OTP
import random
otp_no=random.randint(1111,9999)
print ("Your OTP is: ",otp_no)
otp=int(input("Enter 4 digit OTP no: "))
#Check for OTP
if otp==otp_no:
print("MENU")
print("\n1.Quickcash \n2.Withdraw \n3.Balanceenquiry \n4.Cash
Deposit")
Option=int(input("Enter option number: "))
#1. Quickcash
if Option==1:
print("Choose your amount")
print("\n1.1000 \n2.2000 \n3.3000 \n4.4000 \n5.5000")
#Enter the option for amount to withdraw
Choose=int(input("Enter option no: "))
if Choose==1:
#Fetch balance from database for entered Phoneno
mycursor.execute("Select Balance from Accountdetails
where Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
for x in myresult:
#Converting tuple to string
res = int(''.join(map(str, x)))
z = (str(res))
#Converting String to integer
q = int(z)
#Checking for enough balance available in account
if q>1000:
print("Withdraw successful")
remainbal=q-1000
bal=remainbal
#Updating remaining balance after withdraw
into database
query = "update Accountdetails set
Balance='{}' where Phoneno='{}'".format(bal,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Available balance is: ",bal)
else:
print("Not enough balance")
#2.2000
elif Choose==2:
#Fetch balance from database for entered Phoneno
mycursor.execute("Select Balance from Accountdetails
where Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
for x in myresult:
#Converting tuple to string
res = int(''.join(map(str, x)))
z = (str(res))
#Converting String to integer
q = int(z)
#Checking for enough balance available in account
if q>2000:
print("Withdraw successful")
remainbal=q-2000
bal=remainbal
#Updating remaining balance after withdraw
into database
query = "update Accountdetails set
Balance='{}' where Phoneno='{}'".format(bal,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Available balance is: ",bal)
else:
print("Not enough balance")
#3.3000
elif Choose==3:
#Fetch balance from database for entered Phoneno
mycursor.execute("Select Balance from Accountdetails
where Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
for x in myresult:
#Converting tuple to string
res = int(''.join(map(str, x)))
z = (str(res))
#Converting String to integer
q = int(z)
#Checking for enough balance available in account
if q>3000:
print("Withdraw successful")
remainbal=q-3000
bal=remainbal
#Updating remaining balance after withdraw
into database
query = "update Accountdetails set
Balance='{}' where Phoneno='{}'".format(bal,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Available balance is: ",bal)
else:
print("Not enough balance")
#4.4000
elif Choose==4:
#Fetch balance from database for entered Phoneno
mycursor.execute("Select Balance from Accountdetails
where Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
#Converting tuple to string
for x in myresult:
res = int(''.join(map(str, x)))
z = (str(res))
#Converting String to integer
q = int(z)
#Checking for enough balance available in account
if q>4000:
print("Withdraw successful")
remainbal=q-4000
bal=remainbal
#Updating remaining balance after withdraw
into database
query = "update Accountdetails set
Balance='{}' where Phoneno='{}'".format(bal,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Available balance is: ",bal)
else:
print("Not enough balance")
#5.5000
elif Choose==5:
#Fetch balance from database for entered Phoneno
mycursor.execute("Select Balance from Accountdetails
where Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
for x in myresult:
res = int(''.join(map(str, x)))
#Converting tuple to string
z = (str(res))
#Converting String to integer
q = int(z)
#Checking for enough balance available in account
if q>5000:
print("Withdraw successful")
remainbal=q-5000
bal=remainbal
#Updating remaining balance after withdraw
into database
query = "update Accountdetails set
Balance='{}' where Phoneno='{}'".format(bal,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Available balance is: ",bal)
else:
print("Not enough balance")
else:
print ("Type only 1 to 5 only")
#2. Withdraw
elif Option==2:
withdraw=int(input("Enter amount to withdraw: "))
mycursor.execute("Select Balance from Accountdetails where
Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
for x in myresult:
res = int(''.join(map(str, x)))
#Converting tuple to string
z = (str(res))
#Converting String to integer
q = int(z)
#Checking for enough balance available in account
if q>=withdraw:
print("Withdraw successful")
remainbal=q-withdraw
bal=remainbal
#Updating remaining balance after withdraw into
database
query = "update Accountdetails set Balance='{}'
where Phoneno='{}'".format(bal,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Available balance is: ",bal)
else:
print("Not enough balance")
#3. Balance Enquiry
elif Option==3:
#Fetch balance from database for entered Phoneno
mycursor.execute("Select Balance from Accountdetails where
Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
for x in myresult:
res = int(''.join(map(str, x)))
#Converting tuple to string
z = (str(res))
#Converting String to integer
q = int(z)
print("Available balance is: ",q)
#4. Cash deposit
elif Option==4:
#Enter amount to be deposited
amt=int(input("How much do you want to deposit? "))
#Fetch balance from database for entered Phoneno
mycursor.execute("Select Balance from Accountdetails where
Phoneno={}".format(Phoneno))
myresult = mycursor.fetchall()
for x in myresult:
res = int(''.join(map(str, x)))
#Converting tuple to string
z = (str(res))
#Converting String to integer
q = int(z)
#Calculating total balance after depositing
totalbal=amt+q
bal=totalbal
#Updating total balance after depositing into database
query = "update Accountdetails set Balance='{}' where
Phoneno='{}'".format(bal,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Amount deposited successfully")
print("Available balance is: ",bal)
else:
print("Type only 1 to 4")
else:
print("Incorrect OTP")
elif Lan==2:
print("Sorry!! Currently unavailable")
else:
print("Enter 1 or 2 only")
views()
OUTPUT:
1.Quickcash
Database output:
2. Withdraw
Database output:
3. Balance enquiry
Database output:
4. Cash deposit
Database output:
COVID 19 DATABASE MANAGEMENT SYSTEM
Database creation:
import mysql.connector

db = mysql.connector.connect(
host="localhost",
user="root",
password="2001",
)

mycursor= db.cursor()
mycursor.execute("CREATE DATABASE Covid_19_management_system")
print("Database created successfully")

Output:
Table creation:
mport mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Covid_19_management_system"
)

#database creation
#connectionline
mycursor=mydb.cursor()
#************************************************

mycursor.execute("CREATE TABLE covid_19 (Name varchar(255),Age


int(3),Bloodgroup varchar(255),Phoneno Bigint(20),Address
varchar(255),District varchar(255),State varchar(255),Aadharno
Bigint(15),Vaccination varchar(255),Admit DATE,Discharge DATE,Status
varchar(255))")
print("Table created succesfully")

Output:
Add patient details into database:
class main:
def values():

import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Covid_19_management_system"
)

#value insertion

#connection line

mycursor=mydb.cursor()

#inserting values into database


sql="insert into covid_19
(Name,Age,Bloodgroup,Phoneno,Address,District,State,Aadharno,Vaccination,Admit
,Discharge,Status) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"

Name=input("Enter Name: ")


try:
Age=int(input("Enter Age: "))
except:
print("Type valid age")
Age=int(input("Enter Age: "))
Bloodgroup=input("Enter Bloodgroup: ")
try:
Phoneno=int(input("Enter Phone no: "))
except:
print("Enter valid Phoneno")
Phoneno=int(input("Enter Phone no: "))
Address=input("Enter Address: ")
District=input("Enter district: ")
State=input("Enter state: ")
try:
Aadharno=int(input("Enter aadhar no: "))
except:
print("Enter valid Aadharno")
Aadharno=int(input("Enter aadhar no: "))
Vaccinationdetails=input("Enter vaccination details (Yes[Y]/No[N]): ")
if Vaccinationdetails=="Y":
Vaccination=int(input("How many doses: "))
elif Vaccinationdetails=="N":
Vaccination="NA"
else:
print("Please enter only 'Y' or 'N'")
try:
Admit=input("Enter Date of Admit 'YYYY-MM-DD': ")
except:
print("Enter valid date 'YYYY-MM-DD'")
Admit=input("Enter Date of Admit 'YYYY-MM-DD': ")
try:
Discharge=input("Enter Date of Discharge: ")
except:
print("Enter valid date 'YYYY-MM-DD'")
Discharge=input("Enter Date of Discharge 'YYYY-MM-DD': ")
Statusofpatient=input("Enter patient status Alive[A]/Dead[D]: ")
if Statusofpatient=="A":
Status="ACTIVE"
elif Statusofpatient=="D":
Status="INACTIVE"
else:
print("Please enter only 'A' or 'D'")

val=(Name,Age,Bloodgroup,Phoneno,Address,District,State,Aadharno,Vaccinati
on,Admit,Discharge,Status)

mycursor.execute(sql,val)

mydb.commit()

print("Row added suucessfully...")

# Continuation of adding another patient


def extra():
extra=input("Do You want to add another Patient Yes[Y]/No[N]: ")
if extra=="Y":
object.values()
object.extra()
elif extra=="N":
import os
import sys
import covid
else:
print("Please enter only 'Y' or 'N'")

object=main
object.values()
object.extra()
Output:
Database output:
Updating details into database:
def update():
print("What to you want to update?")
print("\n 1.Name\n 2.Age\n 3.Bloodgroup\n 4.Phoneno\n 5.Address\n
6.District\n 7.State\n 8.Aadharno\n 9.Vaccination\n 10.Admit\n 11.Discharge\n
12.Status\n")
option=int(input("Enter a option: "))
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Covid_19_management_system"
)
mycursor = mydb.cursor()

if option==1:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
Name=input("Enter Name: ")
query = "update covid_19 set Name='{}' where
Phoneno={}".format(Name,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==2:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
try:
Age=int(input("Enter Age: "))
except:
print("Enter valid Phoneno")
Age=int(input("Enter Age: "))
query = "update covid_19 set Age={} where Phoneno={}".format(Age,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==3:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
Bloodgroup=input("Enter Bloodgroup: ")
query = "update covid_19 set Bloodgroup='{}' where
Phoneno={}".format(Bloodgroup,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==4:
try:
Aadharno=int(input("Enter patient Aadharno to update details: "))
except:
print("Enter valid Aadharno")
Aadharno=int(input("Enter patient Aadharno to update details: "))
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
query = "update covid_19 set Phoneno='{}' where
Aadharno={}".format(Phoneno,Aadharno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==5:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
Address=input("Enter Address: ")
query = "update covid_19 set Address={} where
Phoneno={}".format(Address,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==6:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
District=input("Enter District: ")
query = "update covid_19 set District='{}' where
Phoneno={}".format(District,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==7:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
State=input("Enter State: ")
query = "update covid_19 set State='{}' where
Phoneno={}".format(State,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==8:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
try:
Aadharno=int(input("Enter patient Aadharno to update details: "))
except:
print("Enter valid Aadharno")
Aadharno=int(input("Enter patient Aadharno to update details: "))
query = "update covid_19 set Aadharno={} where
Phoneno={}".format(Aadharno,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==9:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
Vaccinationdetails=input("Enter vaccination details (Yes[Y]/No[N]): ")
if Vaccinationdetails=="Y":
Vaccination=int(input("How many doses: "))
elif Vaccinationdetails=="N":
Vaccination="NA"
else:
print("Please enter only 'Y' or 'N'")
query = "update covid_19 set Vaccination={} where
Phoneno={}".format(Vaccination,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==10:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
try:
Admit=input("Enter Date of Admit 'YYYY-MM-DD': ")
except:
print("Enter valid date 'YYYY-MM-DD'")
Admit=input("Enter Date of Admit 'YYYY-MM-DD': ")
query = "update covid_19 set Admit='{}' where
Phoneno={}".format(Admit,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==11:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
try:
Discharge=input("Enter Date of Discharge: ")
except:
print("Enter valid date 'YYYY-MM-DD'")
Discharge=input("Enter Date of Discharge 'YYYY-MM-DD': ")
query = "update covid_19 set Discharge='{}' where
Phoneno={}".format(Discharge,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
elif option==12:
try:
Phoneno=int(input("Enter patient Phoneno to update details: "))
except:
print("Enter valid Phoneno: ")
Phoneno=int(input("Enter patient Phoneno to update details: "))
Statusofpatient=input("Enter patient status Alive[A]/Dead[D]: ")
if Statusofpatient=="A":
Status="ACTIVE"
elif Statusofpatient=="D":
Status="INACTIVE"
else:
print("Please enter only 'A' or 'D'")
query = "update covid_19 set Status='{}' where
Phoneno={}".format(Status,Phoneno)
mycursor.execute(query)
mydb.commit()
print("Updated successfully")
else:
print("Print only 1 to 10")

Output:
Count:
def status():
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Covid_19_management_system"
)
mycursor = mydb.cursor()
query = "SELECT count(*) AS New_column_name FROM covid_19 where Status =
'ACTIVE'"

mycursor.execute(query)
myresult = mycursor.fetchall()
print("NO of ACTIVE Patients are: ",myresult[-1][-1])

query = "SELECT count(*) AS New_column_name FROM covid_19 where Status =


'INACTIVE'"

mycursor.execute(query)
myresult = mycursor.fetchall()
print("NO of INACTIVE Patients are: ",myresult[-1][-1])

query = "SELECT count(*) AS New_column_name FROM covid_19"

mycursor.execute(query)
myresult = mycursor.fetchall()
print("NO of total Patients are: ",myresult[-1][-1])
mydb.close()
Output:
Delete Patient details:
def deleting():
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Covid_19_management_system"
)
mycursor=mydb.cursor()
try:
Phoneno=int(input("Enter Phone no: "))
except:
print("Enter valid Phoneno")
Phoneno=int(input("Enter Phone no: "))
sql = "DELETE FROM covid_19 WHERE Phoneno = '{}'".format(Phoneno)

mycursor.execute(sql)

mydb.commit()

print(mycursor.rowcount, "record(s) deleted")


Output:

Database output:
View patient details:
def views():
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Covid_19_management_system"
)
mycursor=mydb.cursor()

try:
Phoneno=int(input("Enter Phone no: "))
except:
print("Enter valid Phoneno")
Phoneno=int(input("Enter Phone no: "))
mycursor.execute("select * from covid_19 where
Phoneno='{}'".format(Phoneno))
myresult = mycursor.fetchall()

for x in myresult:
print(x)
else:

print("No recors found")


Output:

Database Output:
Main File Program:
#Personal details
print("Name: Balasatha P")
print("Email: balasastha1002@gmail.com")
print("Phone no: 9514281390")
print("Batch: Python")
print("Batch no:74")

import os
import sys
import countstatus
import updating
import view
import delete

def menu_details():
print("\n*****COVID-19 MANAGEMENT SYSTEM*****")
print("\nChoose the option from below menu")
print("\n 1.Add patient details\n 2.Update patient details\n 3.Count status
of active and inactive patients\n 4.Delete a patient\n 5.View particular
patient details\n 6.Exit")
option=int(input("Enter a number: "))
if option==1:
import insert
insert.main
elif option==2:
updating.update()
elif option==3:
countstatus.status()
elif option==4:
delete.deleting()
elif option==5:
view.views()
elif option==6:
print()
else:
print ("Enter only 1 to 6")

menu_details()
HOTEL MANAGEMENT
Database creation:
#SQL Connection
import mysql.connector

db = mysql.connector.connect(
host="localhost",
user="root",
password="2001",
)

mycursor= db.cursor()
mycursor.execute("CREATE DATABASE Hotel_management_system")
print("Database created successfully")

Output:
Table creation for restaurant:
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Hotel_management_system"
)

#database creation
#connectionline
mycursor=mydb.cursor()
#************************************************

mycursor.execute("CREATE TABLE Restaurant (Name varchar(255),Phoneno


Bigint(20),Aadharno bigint(20),Type varchar(255),Cart varchar(255),Days
Bigint(20), Amount Bigint(20))")
print("Table created succesfully")

Output:
Customer details:(Restaurant)
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Hotel_management_system"
)

#database creation
#connectionline
mycursor=mydb.cursor()

sql="insert into Restaurant (Name,Phoneno,Aadharno,Type,Cart,Days,Amount)


values (%s,%s,%s,%s,%s,%s,%s)"

Name=input("Enter Name: ")


try:
Phoneno=int(input("Enter Phoneno: "))
except:
print ("Print valid no")
Phoneno=int(input("Enter Phoneno: "))
try:
Aadharno=int(input("Enter Aadhar no: "))
except:
print("Enter valid no")
Aadharno=int(input("Enter Aadhar no: "))
print ("\nWhat do you prefer? \n1.Accomdation with food \n2.Accomdation
without food")
try:
choice=int(input("Enter your choice: "))
except:
print("Enter valid no")
if choice==1:
print("\nChoose \n1.Single cart \n2.Double")
choose=int(input("\nChoose"))
if choose==1:
Cart="Single cart"
print("\nType of Room \n1.AC \n2.NON-AC")
try:
pick=int(input("Enter option: "))
except:
print("Enter valid no")
pick=int(input("Enter option: "))
if pick==1:
Type="A/C"
print("Total charge for accomdation is: Rs:2000/day")
try:
Days=int(input("Enter no of days: "))
except:
print("Enter valid no")
Days=int(input("Enter no of days: "))
totalamt=Days*2000
Amount=totalamt
print("Total charge is:",Amount)
try:
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
except:
print("Enter valid no")
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
if choose==1:
print("Thanks for choosing us!!!")
elif choose==2:
print()
else:
print("Type only 1 or 2")
elif pick==2:
Type="NON A/C"
print("Total charge for accomdation is: Rs:1000/day")
try:
Days=int(input("Enter no of days: "))
except:
print("Enter valid no")
Days=int(input("Enter no of days: "))
totalamt=Days*1000
Amount=totalamt
print("Total charge is: ",Amount)
try:
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
except:
print("Enter valid no")
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
if choose==1:
print("Thanks for choosing us!!!")
elif choose==2:
print()
else:
print("Type only 1 or 2")
elif choose==2:
Cart="Double cart"
print("\nType of Room \n1.AC \n2.NON-AC")
try:
pick=int(input("Enter option: "))
except:
print("Enter valid no")
pick=int(input("Enter option: "))
if pick==1:
Type="A/C"
print("Total charge for accomdation is: Rs:4000/day")
try:
Days=int(input("Enter no of days: "))
except:
print("Enter valid no")
Days=int(input("Enter no of days: "))
totalamt=Days*4000
Amount=totalamt
print("Total charge is: ",Amount)
try:
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
except:
print("Enter valid no")
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
if choose==1:
print("Thanks for choosing us!!!")
elif choose==2:
print()
else:
print("Type only 1 or 2")
elif pick==2:
Type="NON A/C"
print("Total charge for accomdation is: Rs:2000/day")
try:
Days=int(input("Enter no of days: "))
except:
print("Enter valid no")
Days=int(input("Enter no of days: "))
totalamt=Days*2000
Amount=totalamt
print("Total charge is: ",Amount)
try:
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
except:
print("Enter valid no")
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
if choose==1:
print("Thanks for choosing us!!!")
elif choose==2:
print()
else:
print("Type only 1 or 2")
else:
print ("Enter only 1 or 2")
elif choice==2:
print("\nChoose \n1.Single cart \n2.Double")
choose=int(input("\nChoose \n1.Single cart \n2.Doublecart"))
if choose==1:
Cart="Single cart"
print("\nType of Room \n1.AC \n2.NON-AC")
try:
pick=int(input("Enter option: "))
except:
print("Enter valid no")
pick=int(input("Enter option: "))
if pick==1:
Type="A/C"
print("Total charge for accomdation is: Rs:1000/day")
try:
Days=int(input("Enter no of days: "))
except:
print("Enter valid no")
Days=int(input("Enter no of days: "))
totalamt=Days*1000
Amount=totalamt
print("Total charge is: ",Amount)
try:
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
except:
print("Enter valid no")
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
if choose==1:
print("Thanks for choosing us!!!")
elif choose==2:
print()
else:
print("Type only 1 or 2")
elif pick==2:
Type="NON A/C"
print("Total charge for accomdation is: Rs:500/day")
try:
Days=int(input("Enter no of days: "))
except:
print("Enter valid no")
Days=int(input("Enter no of days: "))
totalamt=Days*500
Amount=totalamt
print("Total charge is: ",Amount)
try:
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
except:
print("Enter valid no")
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
if choose==1:
print("Thanks for choosing us!!!")
elif choose==2:
print()
else:
print("Type only 1 or 2")
elif choose==2:
Cart="Double cart"
print("\nType of Room \n1.AC \n2.NON-AC")
try:
pick=int(input("Enter option: "))
except:
print("Enter valid no")
pick=int(input("Enter option: "))
if pick==1:
Type="A/C"
print("Total charge for accomdation is: Rs:2000/day")
try:
Days=int(input("Enter no of days: "))
except:
print("Enter valid no")
Days=int(input("Enter no of days: "))
totalamt=Days*2000
Amount=totalamt
print("Total charge is: ",Amount)
try:
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
except:
print("Enter valid no")
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
if choose==1:
print("Thanks for choosing us!!!")
elif choose==2:
print()
else:
print("Type only 1 or 2")
elif pick==2:
Type="NON A/C"
print("Total charge for accomdation is: Rs:1000/day")
try:
Days=int(input("Enter no of days: "))
except:
print("Enter valid no")
Days=int(input("Enter no of days: "))
totalamt=Days*1000
Amount=totalamt
print("Total charge is: ",Amount)
try:
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
except:
print("Enter valid no")
choose=int(input("Are you sure want to confrim?
(Yes[1]/No[2]) "))
if choose==1:
print("Thanks for choosing us!!!")
elif choose==2:
print()
else:
print("Type only 1 or 2")
else:
print ("Enter only 1 or 2")
else:
print("Enter only 1 0r 2")

val=(Name,Phoneno,Aadharno,Type,Cart,Days,Amount)

mycursor.execute(sql,val)

mydb.commit()

print("Row added suucessfully...")


Output:
Database output:
Table creation for hotel:
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Hotel_management_system"
)

#database creation
#connectionline
mycursor=mydb.cursor()
#************************************************

mycursor.execute("CREATE TABLE Hotel (Phoneno Bigint(20), Preference


varchar(255), Amount Bigint(20))")
print("Table created succesfully")

Output:
Customer details:(Hotel)
import mysql.connector

mydb=mysql.connector.connect(
host="localhost",
user="root",
password="2001",
database="Hotel_management_system"
)

#database creation
#connectionline
mycursor=mydb.cursor()

sql="insert into Hotel (Phoneno,Preference,Amount) values (%s,%s,%s)"

Phoneno=int(input("Enter Phone no: "))


print ("Preference")
print ("\n1.Breakfast \n2.Lunch \n3.Dinner")
try:
choose=int(input("Enter option: "))
except:
print("Enter valid no")
choose=int(input("Enter option: "))
if choose==1:
Preference="Breakfast"
print("MENU")
print("\n1.Idly \n2.Roast \n3.Chappathi \n4.parotta \n5.Poori")
try:
option=int(input("Enter option: "))
except:
print("Enter valid no")
option=int(input("Enter option: "))
if option==1:
print("Price of one idly is: Rs.5")
qty=int(input("Enter quantity: "))
totalamt=qty*5
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==2:
print("Price of one roast is: Rs.15")
qty=int(input("Enter quantity: "))
totalamt=qty*15
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==3:
print("Price of one Chappathi is: Rs.15")
qty=int(input("Enter quantity: "))
totalamt=qty*15
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==3:
print("Price of one Parotta is: Rs.20")
qty=int(input("Enter quantity: "))
totalamt=qty*20
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==4:
print("Price of one Parotta is: Rs.15")
qty=int(input("Enter quantity: "))
totalamt=qty*15
Amount=totalamt
print("Total bill amount is: ",Amount)
else:
print("Enter only 1 to 4")
elif choose==2:
Preference="Lunch"
print("MENU")
print("\n1.Veg Briyani \n2.Meals \n3.Mushroom Briyani")
try:
option=int(input("Enter option: "))
except:
print("Enter valid no")
option=int(input("Enter option: "))
if option==1:
print("Price of Veg Briyani is: Rs.100")
qty=int(input("Enter quantity: "))
totalamt=qty*100
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==2:
print("Price of Meals is: Rs.80")
qty=int(input("Enter quantity: "))
totalamt=qty*80
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==3:
print("Price of Mushroom Briyani is: Rs.150")
qty=int(input("Enter quantity: "))
totalamt=qty*150
Amount=totalamt
print("Total bill amount is: ",Amount)
else:
print ("Enter only 1 to 3")
elif choose==3:
Preference="Breakfast"
print("MENU")
print("\n1.Idly \n2.Roast \n3.Chappathi \n4.parotta")
try:
option=int(input("Enter option: "))
except:
print("Enter valid no")
option=int(input("Enter option: "))
if option==1:
print("Price of one idly is: Rs.5")
qty=int(input("Enter quantity: "))
totalamt=qty*5
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==2:
print("Price of one roast is: Rs.15")
qty=int(input("Enter quantity: "))
totalamt=qty*15
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==3:
print("Price of one Chappathi is: Rs.15")
qty=int(input("Enter quantity: "))
totalamt=qty*15
Amount=totalamt
print("Total bill amount is: ",Amount)
elif option==3:
print("Price of one Parotta is: Rs.20")
qty=int(input("Enter quantity: "))
totalamt=qty*20
Amount=totalamt
print("Total bill amount is: ",Amount)
else:
print("Enter only 1 to 3")
else:
print ("Enter only 1 to 4")

val=(Phoneno,Preference,Amount)
mycursor.execute(sql,val)

mydb.commit()

print("Row added suucessfully...")


Output:
Database output:

Main program file:


#Personal details
print("Name: Balasatha P")
print("Email: balasastha1002@gmail.com")
print("Phone no: 9514281390")
print("Batch: Python")
print("Batch no:74")

print("Welcome to CUBA hotel and reataurant")


print("\nWhat do you prefer? \n1.Hotel \n2.Restaurant")
try:
choice=int(input("Enter choice: "))
except:
print("Enter valid no")
choice=int(input("Enter choice: "))
if choice==1:
import Hotel
elif choice==2:
import restaurant
else:
print("Enter only 1 or 2")

You might also like