Untitled

mail@pastecode.io avatar
unknown
python
3 years ago
1.4 kB
1
Indexable
Never
# Program description

# =-=-=-=-=-= #
# VARIABLES
# =-=-=-=-=-= #
books = []

# =-=-=-=-=-= #
# FUNCTIONS
# =-=-=-=-=-= #
def print_menu():

    print("1. Add books")
    print("2. Return books")
    print("Issue books")
    print("Edit book record")
    print("Delete record of books issued")
    print("View record of books issued")
    print("Search for books")

def read_choice():
    user_choice = int(input("What do you want to do?: "))
    
    if user_choice == 1:
        add_books()


def add_books():
    book_name = input("Book Name: ")
    book_author = input("Book Author: ")
    publisher_name = input("Publisher Name: ")
    year_of_publishing = input("Year of publishing: ")
    book_edition = input("Book Edition: ")
    brief_of_abstract = input("Brief Abstract: ")
    book_department = input("Department: ")

    book = {
        "book_name": book_name,
        "book_author": book_author,
        "publisher_name": publisher_name,
        "year_of_publishing": year_of_publishing,
        "book_edition": book_edition,
        "brief_of_abstract": brief_of_abstract,
        "book_department": book_department
    }

    books.append(book)


# =-=-=-=-=-=-=-= #
# PROGRAM LOGIC
# =-=-=-=-=-=-=-= #

# Print menu to the user
print_menu()

# Read user choice
read_choice()


print(f'There are {books.length()} books.')
print(books)