abbas-booklib 0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ Metadata-Version: 2.4
2
+ Name: abbas-booklib
3
+ Version: 0.1
@@ -0,0 +1,3 @@
1
+ Metadata-Version: 2.4
2
+ Name: abbas-booklib
3
+ Version: 0.1
@@ -0,0 +1,7 @@
1
+ setup.py
2
+ abbas_booklib.egg-info/PKG-INFO
3
+ abbas_booklib.egg-info/SOURCES.txt
4
+ abbas_booklib.egg-info/dependency_links.txt
5
+ abbas_booklib.egg-info/top_level.txt
6
+ mylibrary/__init__.py
7
+ mylibrary/library.py
@@ -0,0 +1 @@
1
+ mylibrary
File without changes
@@ -0,0 +1,46 @@
1
+ # we can also write:
2
+ #class Library:
3
+ # def __init__(self, books):
4
+ # self.books = books
5
+ #library1 = Library('1984')
6
+
7
+
8
+ class Library:
9
+ def __init__(self):
10
+ self.books = []
11
+
12
+ def add_book(self, title, author):
13
+ self.books.append({
14
+ 'title' : title ,
15
+ 'author' : author
16
+ })
17
+ def show_book(self,):
18
+ for book in self.books:
19
+ print(f" title : {book['title']}| author : {book['author']}")
20
+
21
+ def remove_book(self, title):
22
+ for book in self.books:
23
+ if book['title'] == title:
24
+ self.books.remove(book)
25
+ print(f"the book {title} was removed successfully")
26
+ break
27
+ else:
28
+ print(f"the book {title} was not found")
29
+
30
+ def search_book(self, title):
31
+ for book in self.books:
32
+ if book['title'] == title:
33
+ print(f"the book {title} was found")
34
+ break
35
+ else:
36
+ print(f"the book {title} was not found")
37
+
38
+
39
+ library = Library()
40
+ print(library.books)
41
+ library.add_book("1984", "George Orwell")
42
+ library.add_book("The Hobbit", "J.R.R. Tolkien")
43
+ print(library.books)
44
+ library.remove_book('22')
45
+ library.search_book('1984')
46
+ print(library.books)
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name= 'abbas-booklib',
5
+ version= '0.1',
6
+ packages= find_packages()
7
+ )