Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("books.txt") as b:
- books = b.readlines()[7:]
- books = [x.strip() for x in books]
- books = [x.split(",") for x in books]
- def welcome():
- print("Welcome to the Bookstore")
- global name
- name = input("What is your name? ")
- print("Our current list of books are: ")
- inventory()
- def choice():
- select = input("Which books would you like? (ID):\n")
- global chosen
- chosen = []
- flag = "y"
- while flag == "y":
- chosen.append(select)
- flag = input("Would you like to add more books to your cart? (y/n): ")
- print(chosen)
- for chosen in books:
- books.index(chosen[0])
- def inventory():
- length = len(books)
- for i in range(length):
- print(books[i][0], books[i][1].strip(), ("$" + books[i][2]).replace(" ", ""))
- choice()
- def receipt():
- print("Thank you", name)
- welcome()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement