Skip to content

yunusdonmez-dev/Python_Modul_Week_2

Β 
Β 

Repository files navigation

Python_Modul_Week_2

Library Project

  • In this project, we want you to write a library program using the Python information you have learned so far, error catching - file operations, especially the Json module and file information.
  • In a library; There are two main parts: Membership transactions and Book transactions.
  • Membership transactions include information on adding a member, deleting a member, checking a member, giving a book to a member, and receiving a returned book from a member. A database or file where membership data is recorded is also required.
  • We can say similar things about book transactions.

πŸ“š Mini Book Management System

To detail the project:

  • It will consist of main.py, Kitap_transactions.py, Member_Transactions.py, Zaman.py files.
Main.py:
  • The main file of our project will be the main.py file. Operations will be executed from this file, other Python files will be called from this section as a module. For example, adding a book, deleting a book, adding a member, giving a book to a member, and member control will be done here. This project is a beginner-friendly book management system built with Python. It allows users to manage a collection of books through a simple command-line interface. All data is stored in a JSON file for persistence.

image

πŸš€ Features

  • Add a book (interactive input for each field)
  • Remove a book (by title)
  • Update book details
  • Search for a book (by title)
  • List all books
  • Below you will see a run output of this project. You can run the functions in the book_transactions and membership_transactions modules via inputs on the main page.

πŸ—‚οΈ Book Format

image Each book is stored in the following format inside the books.json file:

{
  "title": "1984",
  "author": "George Orwell",
  "year": 1949,
  "genre": "Dystopian"
}

πŸ› οΈ Technologies Used

book_transactions.py :
  • In this module, you will write book information (registered books and total number), add, delete, search and update functions. We will save our data in the book.json file. The Kitap.json file will be given to you (you can create it yourself if you wish). File control must be done with the Os Module. Below you can find function examples for book transactions, but you do not have to follow them, you can make your own planning.
  • Python 3.x
  • JSON module (built-in)

image

πŸ“ File Structure

mini_book_system.py       # Main script
books.json                # Data file storing all books
  • There is a lot of data in the Kitap.json file. We will work with the following data. We will use these as basis when adding new data or searching.

πŸ“Œ Installation & Usage

image

  1. Make sure Python 3 is installed.
  2. Clone the repository:
    git clone https://github.com/yourUsername/mini_book_system.git
  3. Run the script:
    python mini_book_system.py

πŸ“„ How It Works

Book.json :

sample output is as follows When you run the program, you'll be presented with a menu:

image

1. Add a book
2. Remove a book
3. Update a book
4. Search for a book
5. List all books
6. Exit

βž• Add a Book

Membership_transactions.py:
  • Here, operations such as member information (member names and total number of members), member updating, adding members, searching for members, deleting members, lending books and returning books will be performed. Additionally, members must be saved in the uye.Json file. When lending a book, it is absolutely
    • The date and time the book was lent and the date to return it after 2 weeks should be added and this information should be saved in the taksi.json file. You will be prompted to enter each field one by one:

image

Enter book title:
Enter author name:
Enter publication year:
Enter genre:

The book will be saved in books.json.

  • We will do this from the py module when we create it ourselves.
    • After being saved in the taksi.json file, the loaned book should be deleted from Kitap.json so that it does not appear when someone else wants to buy it.
Note: You will create the user.json and tracking.json file yourself.

βž– Remove a Book

image You will be asked to enter the title of the book to remove. If found, it will be deleted from the JSON file.

✏️ Update a Book

  • The data you will save to Uye.json should be as follows: You can update any field of a book by entering its title and then choosing which field to modify.

image

πŸ” Search for a Book

Search by title. If found, the book's details will be displayed.

time.py :
  • We lend our books to our members for 2 weeks. Therefore, we will record the time and date of the loan and the date when it should be returned, thanks to this module. When we run this module, we want it to return the current time and the time 2 weeks later.

πŸ“‹ List All Books

image Displays all books currently stored in the JSON file.

🎯 Purpose

The data you will save in tracking.json should be as follows:

This project is ideal for Python learners who want to practice:

image

  • File handling with JSON
  • User input and validation
  • Basic CRUD operations
  • Modular and interactive programming

πŸ“¬ Contribute

Hackerrank Questions

Feel free to fork the project and submit pull requests to improve functionality or add new features!

  1. Diagonal Difference: https://www.hackerrank.com/challenges/diagonal-difference/problem

  1. Left Rotation: https://www.hackerrank.com/challenges/array-left-rotation/problem

  2. Counter game: https://www.hackerrank.com/challenges/counter-game/problem

  3. Time Delta: https://www.hackerrank.com/challenges/python-time-delta/problem

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%