Mini Project 1 (OOPs Library) Solution | Python Tutorials For Absolute Beginners In Hindi #101

preview_player
Показать описание

Best Hindi Videos For Learning Programming:

Follow Me On Social Media
Рекомендации по теме
Комментарии
Автор

Bhai university ke avishkar me bahut busy tha to playlist i think 29th vdo se dekhni baki hai ...Ye vdo pura dekha hai aur playlist bhi jarur dekhunga.... Thank you sooo much for making this playlist ...Salute you to take those efforts

thirstycoder
Автор

Almost 600k views in your first episode and 16k in this video when we are so close to finishing, I feel bad for all those who left in between

arpan
Автор

Sir maine aapki ye playlist #0 se dekhi hai maine bhiot kuchh aapse sikha hai
Thankyou Sir sachmein thankyou

dakshgarg
Автор

Yes sir I have watched this video from start to end . And I have covered your full course of python as well.

AnkushSaral
Автор

Im ur fan
from u i had learned too much of about program 😗😗

_devenderpal_
Автор

Yes I have watched all your videos and did most of the exercise

yourclothsmith
Автор

today i complete your 101 videos are awesome brother

Harpreetsingh-oghv
Автор

Thanks bhai this mini project was very helpful. I completed it my self using Google.

itsme
Автор

Harry Bhai, Love U'r tutorials....
Here is my solution:
import json
class Library:
def __init__(self, list_of_books, name_of_library, user_name):
self.books = list_of_books
self.library_name = name_of_library
self.user = user_name

def display_book(self):
"""to display books in the library"""
if len(self.books) != 0: #if library is empty
print(f"The list of books in Library: ")
for i, (key, value) in
print(f"{i+1} {value}")
else:
print("Library is empty at the moment...")

def lend_book(self):
"""to lend a book from the library"""
lend_book_name = input("Enter the name of the book you want to lend: ")
for i, (key, value) in
if value == lend_book_name:
self.lend_book_key = key
self.lend_book_value = value

with open('files/lend_book.txt', "r+") as lend_w1: #lend_book.txt to read --> update
data = lend_w1.read()
self.lend_book_list = json.loads(data)
lend_book_name})
with open('files/lend_book.txt', 'r+') as lend_w2: # Update the lend_book dictionary

print(f"'{self.user.upper()}' You have successfully lended the book '{self.lend_book_value}'")

with open('files/books_dict.txt', "r+") as lend_r: #books_dict.txt to read --> update
data = lend_r.read()
self.books = json.loads(data)
# del self.books[self.user]
del #deletes from books_dict.txt
with open('files/books_dict.txt', "w") as lend_update:


def add_book(self):
"""to donate a book in the library"""
donate = input("Name of the book you want to donate: ")

with open('files/books_dict.txt', 'r+') as update1: #write the whole new dictionary to file

print(f"{self.user.upper()} You have been donated the book '{donate}' successfully. Thank you for your donation")

def return_book(self):
"""to return the lended book in the library"""
with open('files/lend_book.txt', "r+") as return_w1:
self.return_book1 = return_w1.read()
self.return_book_list =
for i, (key1, value1) in enumerate(
# to display book name to user when returning the book the
if key1 == self.user:
self.return_key1 = key1
self.return_value1 = value1
return1 = input(f"Want to return the book '{self.return_value1}' - y/n: ")

with open('files/lend_book.txt', "r+") as return_w1: # lend_book.txt to read --> update
self.return_book = return_w1.read()
self.return_book_list = json.loads(self.return_book)
for i, (key, value) in
if return1.upper() == "Y":
if key == self.user:
self.return_key = key
self.return_value = value

del # deletes from lend_book
with open('files/lend_book.txt', "w") as return_update: # update the delete into lend_book


self.return_value})
with open('files/books_dict.txt', 'r+') as update2: # update the return to books_dict



if __name__ == "__main__":
with open('files/books_dict.txt', "r+") as book_read:
data = book_read.read()
book_list = json.loads(data) #make the file 'books_dict' dictionary from string

name = input("Enter your name: ")
SanjoyLibrary = Library(book_list, "library_name", name)

while (1):
user_inp = int(input("\n'1' - Display Books | '2' - Lend Book | '3' - Want to donate a Book | '4' - Return Book\n"))

if user_inp == 1:
SanjoyLibrary.display_book()
elif user_inp == 2:
SanjoyLibrary.lend_book()
elif user_inp == 3:
SanjoyLibrary.add_book()
elif user_inp == 4:
SanjoyLibrary.return_book()
else:
print("Not a valid option!")

user_inp2 = input("Press 'Q' to quit | Press any key to continue...\n")
if user_inp2.upper() == "Q":
exit()
if user_inp2.upper() == "C":
continue

sanjoyroy
Автор

Sir I wrote all the program in the same manner like u...n there is no error but it can't retrieve the values

spaceworld
Автор

Harry bhai awesome program bro a beginner also can learn many things from this program...
Appreciated a lot

kazimali
Автор

I seen this full playlist and this full video.

programmerlovers
Автор

Maine video pura dekha hai...aur harry bhai GUI ka video kab aega..

akashgupta
Автор

Harry Bhai.. This exercise is very good.. I have a question, : This code is working fine in one iteration, suppose we need to keep update the details as per actions taken and use the same so that if same code is run later we get the updated list.. Agar kisi ne koi bood add kiya ho ya lend liya ho, toh that details should remain in the next run.. ( I mean think of a professional library software where running the code will give the real picture).. How can we achieve this.?

dheerajbulchandani
Автор

If a book is rented out for more than 20 days, fine will be added to
the user. The fine will be cummulative after every 5 days after that.
eg: After 20 days, the fine will be Rs. 20, after 5 days, it will be
20+25, after another 5 days it will be 20+25+30.

how can i add this question solution in your code if it is, please provide

sandipsandal
Автор

Harrybhai....jab ham ae code wala software kisi or ko dege jisko coding ke bare me ku6 malum hi nathi ho ki kese list add ki jaye code ke ander to wo kese apni library bana paye ga.??...mera kehne ka matalab ye he ke end user jab apni library ke liye software use karega to wo thodi na coding me jake apni library ki sari book ki list add karega...

KNOWLEDGE_ISS_EVERYTHING
Автор

Thank you so much @codewithharry, for such a great explanation..!

tejalmohod
Автор

Sir lend book function is so hard to understand may you make a another vedio or make me easy to understand it ❤ its a request

devtewatia
Автор

Bhai highlights tab par koi video banao in pycharm

DipakKumar-iybr
Автор

Sir please start series to solve some hackerrank python problems🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

sarthakkhare
join shbcf.ru