본문 바로가기

파이썬

파이썬으로 부동산고객관리 시스템 코드

728x90
반응형

파이썬을 이용하여 간단한 고객 관리 시스템을 구현하는 예제 코드

class Customer:
    def __init__(self, name, phone_number):
        self.name = name
        self.phone_number = phone_number

class RealEstate:
    def __init__(self):
        self.customers = []
    
    def add_customer(self, customer):
        self.customers.append(customer)
    
    def search_customer(self, name):
        for customer in self.customers:
            if customer.name == name:
                return customer
        return None

real_estate = RealEstate()

while True:
    print("[1] Add Customer")
    print("[2] Search Customer")
    print("[3] Quit")
    choice = int(input("Enter your choice: "))
    
    if choice == 1:
        name = input("Enter the name of the customer: ")
        phone_number = input("Enter the phone number of the customer: ")
        customer = Customer(name, phone_number)
        real_estate.add_customer(customer)
        print("Customer added successfully!")
    elif choice == 2:
        name = input("Enter the name of the customer: ")
        customer = real_estate.search_customer(name)
        if customer is None:
            print("Customer not found.")
        else:
            print("Name:", customer.name)
            print("Phone Number:", customer.phone_number)
    elif choice == 3:
        break
    else:
        print("Invalid choice. Try again.")

이 예제 코드는 고객 관리에 필요한 기본적인 기능을 구현한 것으로, 실제 사용에서는 더 많은 기능이 필요할 수 있습니다. 이 코드를 바탕으로 개발을 진행하시고, 부족한 부분은 추가 구현하시면 됩니다.

728x90
반응형