Make a online library using python



Hey guys once again welcome to the Decoders blog, I hope you all are doing well and today I'm present with online library(using PYTHON). The given code will help you to built it, so just follow the codes and make your own library, and enjoy it with your friends

from datetime import datetime
now = datetime.now()
d1=now.strftime("on %b-%d-%Y at %H:%M")
print("library org starting......")
dict=["The Magic of thinking big","7 habits of a succesful person","the fault in our
stras","Ghostbusters"]
def lendbooks():
f=open("lend.txt","a")
def donatebooks():
g=open("donate.txt","a")
def seelists():
print("available books in the library",dict)
visted=0
while visted==0:
n1=input("enter your name:")
n2=input("do you want to lend/donate books or want to watch the lists of
    available books in the library:")
if n2=="lend":
name=input("enter the name of the book::")
author=input("enter the name of the publisher::")
f=open("lend.txt","a")
f.write(d1+"you borrowed "+name+" Authors's name:"+author+"\n")
print("thanks for using library.org")
elif n2=="donate":
name=input("enter the name of the book::")
author=input("enter the name of the publisher::")
g=open("donate.txt","a")
g.write(d1+"you donated"+name+" Authors's name:"+author+"\n")
print("thanks for using library.org")
elif n2=="seelist":
seelists()
n2=input("do you want to lend/donate books::")
if n2=="lend":
name=input("enter the name of the book::")
author=input("enter the name of the publisher::")
f=open("lend.txt","a")
f.write(d1+"you borrowed "+name+" Authors's name:"+author+"\n")
print("thanks for using library.org")
elif n2=="donate":
name=input("enter the name of the book::")
author=input("enter the name of the publisher::")
g=open("donate.txt","a")
g.write(d1+"you donated"+name+" Authors's name:"+author+"\n")
print("thanks for using library.org")
else:
print("unknown input")
y_n=input("do you want to use library.org again:")
if y_n=="y":
print("restart library.org.......")
visited=0
elif y_n=="n":
print("stopping library.org.......")
break
else:
print("unknown input")

Comments

Popular Posts