0% found this document useful (0 votes)
0 views11 pages

Hotel Management System in Python M.S.

The document outlines a Hotel Management System implemented in Python, which allows users to book rooms, view available rooms, check current guests, and facilitate checkouts. It includes a user-friendly menu with emoji-based options and utilizes a dictionary to track room availability. The system provides feedback on room status and validates user input throughout the booking process.

Uploaded by

a45100295
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views11 pages

Hotel Management System in Python M.S.

The document outlines a Hotel Management System implemented in Python, which allows users to book rooms, view available rooms, check current guests, and facilitate checkouts. It includes a user-friendly menu with emoji-based options and utilizes a dictionary to track room availability. The system provides feedback on room status and validates user input throughout the booking process.

Uploaded by

a45100295
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Hotel

Management
System
in Python.

Prepared by: Mehemmed Sultanli,


Aydan Osmanli, Ayan Kazimova Group: ZU 024

Teacher: Konul Mammadova

Baku- 2025
rooms = {room_num: None for room_num in range(101, 111)}

# Helper: Print room layout


def show_room_layout():
print("\n Hotel Room Layout")
for i, room in enumerate(rooms, 1):
status = "☑" if rooms[room] is None else "☒"
print(f"|{room} {status}|", end="\t")
if i % 3 == 0:
print()
print("☑ Available ☒ Occupied\n")

def book_room():
show_room_layout()
name = input("Enter guest name: ")
try:
room = int(input("Enter room number to book (101–110): "))
if room in rooms:
if rooms[room] is None:
rooms[room] = name
print(f"✅ Room {room} successfully booked for {name}.\
n")
else:
print(f"❌ Room {room} is already occupied by
{rooms[room]}.\n")
else:
print("⚠️Invalid room number.\n")
except ValueError:
print("⚠️Please enter a valid number.\n")

def view_available_rooms():
print("\n📋 Available Rooms:")
available = [room for room, guest in rooms.items() if guest is
None]
if available:
print("✅ " + ", ".join(str(r) for r in available))
else:
print("❌ No rooms available.")
print()

def view_customers():
print("\n👤 Current Guests:")
occupied = False
for room, guest in rooms.items():
if guest:
print(f"Room {room}: {guest}")
occupied = True
if not occupied:
print("⚠️No rooms are currently occupied.")
print()

def checkout_room():
show_room_layout()
try:
room = int(input("Enter room number to checkout: "))
if room in rooms:
if rooms[room] is not None:

Code Link:
print(f"✅ {rooms[room]} checked out from room {room}.")
rooms[room] = None
else:
print("⚠️Room is already empty.")
else:
print("⚠️Invalid room number.")
except ValueError:
print("⚠️Please enter a valid number.")
print()

while True:
print("=== 🏨 Welcome to Hotel ===")
print("1. Book Room")
print("2. 📂 View Available Rooms")
print("3. 👥 View Customers")
print("4. 🚪 Checkout Room")
print("5. ❌ Exit")

choice = input("Choose an option (1–5): ")

if choice == '1':
book_room()
elif choice == '2':
view_available_rooms()
elif choice == '3':
view_customers()
elif choice == '4':
checkout_room()
elif choice == '5':
print("👋 Thank you for choosing our Hotel.")
break
else:
print("⚠️Invalid choice. Try again.\n")

https://justpaste.it/doefu
Book rooms

View available rooms

Project
View customers
Objective
Check out

Exit program
Room rooms = {room_num: None for room_num in range(101, 111)}

Initializatio
n Explanation:
•A dictionary tracks 10 rooms (101–110).
•None means the room is free.
•Guest names are stored when booked.
def show_room_layout():
for room in rooms:
status = "🟩" if rooms[room] is None else "🟥"
print(f"|{room} {status}|", end="\t")

Visual
Room What it does:
•Displays rooms in a row format.
Layout •🟩 = available, 🟥 = occupied
•Adds visual clarity for users in the terminal
def book_room():
name = input("Enter name: ")
room = int(input("Enter room #: "))
if rooms[room] is None:
rooms[room] = name

Booking a Highlights:
Room •Displays room layout before booking.
•Validates if room is available.
•Saves guest’s name.
def view_available_rooms():
for room, guest in rooms.items():
if guest is None:
print(f"Room {room}")

View
Available Explanation:
Rooms •Lists all free rooms.
•Uses ✅ message if rooms are available.
•If none are free: shows ❌
def view_customers():
for room, guest in rooms.items():
if guest:
print(f"Room {room}: {guest}")

View Explanation:
Customers •Displays currently booked rooms.
•Simple guest tracker.
•Uses ⚠️if no guests are checked in.
def checkout_room():
room = int(input("Room #: "))
if rooms[room]:
rooms[room] = None

Checkout What it does:


Function •Lets a guest check out.
•Frees up the room.
•Uses ✅ and ⚠️messages for feedback.
while True:
print("1. Book Room")
...

Main Menu Explanation:


with Emojis •Menu is emoji-based and user-friendly.
•Loops until user exits (option 5).
•Each option maps to a specific feature.
=== 🏨 Welcome to Hotel ===
1. Book Room
2. 📂 View Available Rooms
3. 👥 View Customers
4. 🚪 Checkout Room

Visual 5. ❌ Exit
Choose an option (1–5):

Features in
Terminal:
input("Enter your choice: ")
print("Room 101 is available ✅")

Visual Features in Terminal:


•✅ Unicode characters (✔️, ❌, 🟩, 🟥) work in most modern terminals.
•Rooms are displayed in a grid layout using print() statements.
•Input/output is done via the terminal with:

You might also like