-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (42 loc) · 1.42 KB
/
main.py
File metadata and controls
51 lines (42 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from library import Library
from book import Book
def main():
lib = Library()
while True:
print("\n📚 Kütüphane Uygulaması 📚")
print("1. Kitap Ekle")
print("2. Kitap Sil")
print("3. Kitapları Listele")
print("4. Kitap Ara")
print("5. Çıkış")
choice = input("Seçiminiz: ")
if choice == "1":
isbn = input("ISBN giriniz: ")
if lib.add_book(isbn):
print("✅ Kitap eklendi.")
else:
print("⚠️ Kitap eklenemedi.")
elif choice == "2":
isbn = input("Silmek istediğiniz kitabın ISBN'i: ")
if lib.remove_book(isbn):
print("✅ Kitap silindi.")
else:
print("⚠️ Kitap bulunamadı.")
elif choice == "3":
books = lib.list_books()
if books:
for b in books:
print(b)
else:
print("📭 Kütüphane boş.")
elif choice == "4":
isbn = input("Aranan kitabın ISBN'i: ")
book = lib.find_book(isbn)
print(book if book else "Kitap bulunamadı.")
elif choice == "5":
print("👋 Çıkış yapılıyor...")
break
else:
print("⚠️ Geçersiz seçim!")
if __name__ == "__main__":
main()