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
반응형
'파이썬' 카테고리의 다른 글
데이터프레임 특정값을 Nan으로 변경하기 (0) | 2023.02.09 |
---|---|
PDF 문서에서 테이블을 추출하여 판다 데이터 프레임으로 변환 (0) | 2023.02.09 |
파이썬을 이용해서 부동산 관련 문서를 정리하는 코드의 예제 (0) | 2023.02.09 |
파이썬에서 엑셀로 저장할 때 보기좋게 정리하는 코드 (0) | 2023.02.09 |
데이터프레임을 엑셀파일로 저장시 시간이 지나면 엑셀파일을 열지 못하도록하는 파이썬 코드 (0) | 2023.02.09 |