Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
git first project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mahdi Amini
git first project
Commits
16d7f5b2
Commit
16d7f5b2
authored
Feb 24, 2026
by
Mahdi Amini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sffgs
parents
Pipeline
#1760
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
test33.py
test33.py
+69
-0
No files found.
test33.py
0 → 100644
View file @
16d7f5b2
class
Book
:
def
__init__
(
self
,
book_id
,
title
,
author
):
self
.
book_id
=
book_id
self
.
title
=
title
self
.
author
=
author
def
__str__
(
self
):
return
f
"{self.title} - {self.author}"
class
Library
:
def
__init__
(
self
,
library_id
,
title
):
self
.
library_id
=
library_id
self
.
title
=
title
self
.
books
=
{}
def
add_book
(
self
,
book
,
count
):
if
book
.
book_id
in
self
.
books
:
self
.
books
[
book
.
book_id
][
"count"
]
+=
count
else
:
self
.
books
[
book
.
book_id
]
=
{
"book"
:
book
,
"count"
:
count
}
def
__str__
(
self
):
return
self
.
title
class
Student
:
def
__init__
(
self
,
student_id
,
full_name
):
self
.
student_id
=
student_id
self
.
full_name
=
full_name
def
__str__
(
self
):
return
self
.
full_name
# ...
class
Borrow
:
def
__init__
(
self
,
student
,
book
,
library
):
self
.
student
=
student
self
.
book
=
book
self
.
library
=
library
def
info
(
self
):
return
f
"{self.student} کتاب «{self.book}» را از کتابخانه {self.library} گرفته است"
book1
=
Book
(
1
,
"رازآلوده"
,
"نویسنده حسین"
)
book2
=
Book
(
2
,
"test"
,
"author test"
)
library1
=
Library
(
1
,
"تاریخی"
)
library2
=
Library
(
2
,
"ورزشی"
)
library1
.
add_book
(
book1
,
3
)
library2
.
add_book
(
book2
,
1
)
student1
=
Student
(
1
,
"Ali"
)
borrow1
=
Borrow
(
student1
,
book1
,
library1
)
print
(
borrow1
.
info
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment