def start():
    while (True):
        print("        LIb. Management system ::::    ")
        print("------------------------------------------------------")
        print("Enter 1. Show Book List")
        print("Enter 2. Borrow a book")
        print("Enter 3. Return a book")
        print("Enter 4. Exit")
        try:
            bookselection = int(input("Select a choice from 1-4: "))
            print()
            if (bookselection == 1):
                with open("stock.txt", "r") as f:
                    lines = f.read()
                    print(lines)
                    print()

            elif (bookselection == 2):
                ListSplit.listSplit()
                Borrow.borrowBook()
            elif (bookselection == 3):
                ListSplit.listSplit()
                Return.returnBook()
            elif (bookselection == 4):
                print("Thank you for using library management system")
                break
            else:
                print("Please enter a valid choice from 1-4")
        except ValueError:
            print("Please input as suggested.")
Exemplo n.º 2
0
def welcomeToLibrary():
    while (True):
        print("------------------------------------------------------")
        print("        Welcome to the Library Management System      ")
        print("------------------------------------------------------")
        print("Enter 1. To Display")
        print("Enter 2. To Borrow a book")
        print("Enter 3. To return a book")
        print("Enter 4. To exit")
        try:
            choice = int(input("Select a choice from 1-4: "))
            print()
            if (choice == 1):
                with open("stock.txt", "r") as f:
                    lines = f.read()
                    if (lines == ''):
                        print(" There are no books in the Library ")
                    else:
                        print(lines)
                    print()

            elif (choice == 2):
                ListSplit.listSplit()
                Borrow.borrowBook()
            elif (choice == 3):
                ListSplit.listSplit()
                Return.returnBook()
            elif (choice == 4):
                print("Thank you for using library management system")
                break
            else:
                print("Please enter a valid choice from 1-4")
        except ValueError:
            print("Please input as suggested.")
Exemplo n.º 3
0
def start():
    while (True):
        print("        Welcome to the library management system     ")
        print("------------------------------------------------------")
        print("Enter 1. To Display")
        print("Enter 2. To Borrow a book")
        print("Enter 3. To return a book")
        print("Enter 4. To exit")
        try:
            a = int(input("Select a choice from 1-4: "))
            print()

            if (a == 1):
                with open("D:\\LMS\stock.txt", "r") as f:
                    for x in f:
                        print(x)

            elif (a == 2):
                ListSplit.listSplit()
                Borrow.borrowBook()
            elif (a == 3):
                ListSplit.listSplit()
                Return.returnBook()
            elif (a == 4):
                print("Thank you for using library management system")
                break
            else:
                print("Please enter a valid choice from 1-4")
        except ValueError:
            print("Please input as suggested.")
def start():
    while (True):
        print("        Bem vindo ao sistema da biblioteca Caribe     ")
        print("------------------------------------------------------")
        print("Digite 1. Para mostrar os livros")
        print("Digite 2. Para retirar um livro")
        print("Digite 3. Para devolver um livro")
        print("Digite 4. Para sair")
        try:
            a = int(input("Escolha uma opção de 1-4: "))
            print()
            if (a == 1):
                with open("stock.txt", "r") as f:
                    lines = f.read()
                    print(lines)
                    print()

            elif (a == 2):
                ListSplit.listSplit()
                Borrow.borrowBook()
            elif (a == 3):
                ListSplit.listSplit()
                Return.returnBook()
            elif (a == 4):
                print("Obrigado por usar o site da Biblioteca Caribe Online")
                break
            else:
                print("Por favor digite uma escolha valida de 1-4")
        except ValueError:
            print("Por favor digite como sugerido.")
Exemplo n.º 5
0
                     #Calling defined function to display all the available books in the Library.
                     Display.display_data(list_two)
                
                elif choice == 2:
                         print("The books available for borrowing are as follows:")
                         Display.display_data(list_two)
                         print('\n')
                         
                         
                           
                         #Asking user input for number of books desired and their Book ID.
                         input_id = str(input("Please enter the BookID of your desired book."))

                         
                         #Calling the function that operates borrow action.
                         borrower_books = Borrow.borrow_action(list_two,input_id)

                         if len(borrower_books) > 0:
                                 #Appending the books borrowed into the borrower cart as a list.
                                 borrower_cart.append(borrower_books)

                                 #Calling previously defined function to display Borrower Cart.
                                 Display.display_borrow(borrower_cart)
                         else:
                                print('\n')
                                print('Please enter another valid Book ID.')