Some scrap codes for hotel management Program written in PYTHON.
Version: 2.7
Here's the code:
print "xxx HOTEL MANAGEMENT CODE"
i = 0
rooms = [1,0,1,0,1,0,1,1,1,0]#few rooms are in use an few are vaccant initially.
names = ["Abhinav","n","Aman","n","Rishik","n","Fiha","Barak Obama","Chapti","n"]
while i != 1:
will = raw_input("Hit a for adding customer/r for removing/l for list of rooms/e to exit : ")
if will == "a":
if 0 in rooms and "n" in names:
if 1 in rooms:
print "Room number",rooms.index(0)+1,"is Vaccant."
else:
print "All rooms are Vaccant."
ci = raw_input('Press a to check in to any room or any key to return to main menu or d to check for a desired room number: ')
z=rooms.index(0)
if ci == "a":
rooms[z]=1
name = raw_input('Enter the name of customer: ')
names[z]=name
print "Customer checked in. Collect the cash."
elif ci == "d":
cid = input("Enter the desired room number: ")-1
if cid > 10 or cid < 1:
print "Please don't joke this hotel has only 10 rooms."
else:
if rooms[cid] == 1:
print "Sorry the specific room is taken"
else:
rooms[cid]=1
name = raw_input('Enter the name of customer: ')
names[cid]=name
print "Customer checked in. Collect the cash."
else:
pass
else:
print "All rooms are taken."
elif will == "l":
print "\n",names,"\n"
elif will == "r":
if 1 in rooms:
re = input("Enter the room number which is to be made vaccant: ")
if re > 10 or re < 1:
print "Please don't joke this hotel has only 10 rooms."
else:
rooms[re-1]=0
names[re-1]="n"
else:
print "No room is booked."
elif will == "e":
i = 1
No comments:
Post a Comment