Advertisement
Guest User

Untitled

a guest
Oct 9th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 23.10 KB | None | 0 0
  1. import pymysql
  2. import random
  3.  
  4. db = pymysql.connect("localhost", "root", "Hero2of1war", "lib")
  5. cursor = db.cursor()
  6.  
  7.  
  8. class Library(object):
  9.     def __init__(self):
  10.         super(Library, self).__init__()
  11.  
  12.         self.number_of_library = ''  # library_number
  13.         self.street = ''
  14.         self.phone_number = 0
  15.         self.books = []
  16.         self.visitors = []
  17.         self.history = []
  18.         self.authors = []
  19.  
  20.     def add_book(self, book):
  21.         # not_found = True
  22.         # for i in self.books:
  23.         #     if i.name == book.name and i.author == book.author:
  24.         #         not_found = False
  25.         #         break
  26.         # if not_found:
  27.         #     self.books.append(book)
  28.         # else:
  29.         #     print('Book exist!')
  30.  
  31.         for i in self.books:
  32.             if i.name == book.name and i.author == book.author:
  33.                 print('Book exist!')
  34.                 break
  35.         else:
  36.             self.books.append(book)
  37.  
  38.     def delete_book(self, name, author):
  39.         book = False
  40.         for i in lib.books:
  41.             if i.name == name and i.author == author:
  42.                 self.books.remove(i)
  43.                 return True
  44.         if book == False:
  45.                 print('This book not exist')
  46.                 return False
  47.  
  48.     def search_book(self, book):
  49.         for i in self.books:
  50.             if i.name == book:
  51.                 return i
  52.  
  53.     def add_visitor(self, visitor):
  54.         not_found = True
  55.         for i in self.visitors:
  56.             if i.name == visitor.name and i.last_name == visitor.last_name and i.number == visitor.number:
  57.                 not_found = False
  58.         if not_found == True:
  59.                 self.visitors.append(visitor)
  60.         else:
  61.             print('Visitor exist!')
  62.             return False
  63.  
  64.     def remove_visitor(self, name, last_name, number):
  65.         remove = False
  66.         for i in lib.visitors:
  67.             if i.name == name and i.last_name == last_name and i.number == number:
  68.                 lib.visitors.remove(i)
  69.                 return True
  70.         if remove == False:
  71.                 print('Can not delete!')
  72.                 return False
  73.  
  74.     def write_book_visitor(self, write, book, data):
  75.         book_in_visitor = BookInVisitor(visitor_name, visitor_last_name, book_name, book_author, data)
  76.         book_in_visitor.visitor_name = write.name
  77.         book_in_visitor.visitor_last_name = write.last_name
  78.         book_in_visitor.book_name = book.name
  79.         book_in_visitor.book_author = book.author
  80.         book_in_visitor.data_of_take = data
  81.  
  82.         self.history.append(book_in_visitor)
  83.  
  84.     def print_history(self):
  85.         for i in self.history:
  86.             print(i.visitor_name + ' take', i.book_name)
  87.  
  88.     def edit_book(self, old_name, new_name):
  89.         for i in lib.books:
  90.             if i.name == old_name:
  91.                 i.name = new_name
  92.  
  93.     def edit_visitors(self, old_name, old_last_name, old_number, new_name, new_last_name, new_number):
  94.         for i in lib.visitors:
  95.             if i.name == old_name and i.last_name == old_last_name and i.number == old_number:
  96.                 i.name = new_name
  97.                 i.last_name = new_last_name
  98.                 i.number = new_number
  99.  
  100.     def user_exist(self, old_name, old_last_name, old_number):
  101.         not_exist = False
  102.         for i in lib.visitors:
  103.             if i.name == old_name and i.last_name == old_last_name and i.number == old_number:
  104.                 return True
  105.         if not_exist == False:
  106.                 print('Not exist')
  107.                 return False
  108.  
  109.     def find_book_by_name(self, name, author):
  110.         for i in lib.books:
  111.             if i.name == name and i.author == author:
  112.                 return i
  113.         # return None
  114.  
  115.     def find_visitor_by_name(self, name, last_name):
  116.         for i in lib.visitors:
  117.             if i.name == name and i.last_name == last_name:
  118.                 return i
  119.         # return None
  120.  
  121.     # add_return_date
  122.     def add_data_of_remove(self, name, last_name, book, author, remove_date):
  123.         for i in lib.history:
  124.             if i.visitor_name == name and i.visitor_last_name == last_name and i.book_name == book and i.book_author == author:
  125.                 i.remove_of_data = remove_date
  126.  
  127.     def initialize_database(self):
  128.         cursor.execute("INSERT INTO gender (id, name) VALUES (NULL, 'male')")
  129.         cursor.execute("INSERT INTO gender (id, name) VALUES (NULL, 'female')")
  130.         db.commit()
  131.         # cursor.execute("SELECT name FROM gender")
  132.         # name_gender = cursor.fetchall()
  133.  
  134.  
  135.  
  136.  
  137. class Book(object):
  138.     def __init__(self,id, name, author, date, count = '', available_count = ''):
  139.         super(Book, self).__init__()
  140.  
  141.         self.id = id
  142.         self.name = name
  143.         self.author = author
  144.         self.date = date
  145.         self.count = count
  146.         self.available_count = available_count
  147.  
  148.     def save(self):
  149.         cursor.execute("INSERT INTO book (id, name, date, count, available_count) VALUES (NULL, '{0}', '{1}', {2}, {3})".format(self.name, self.date, self.count, self.available_count))
  150.  
  151. class Visitor(object):
  152.     def __init__(self, id, name, last_name, birth_date, number, gender):
  153.         super(Visitor, self).__init__()
  154.  
  155.         self.id = id
  156.         self.name = name
  157.         self.last_name = last_name
  158.         self.birth_date = birth_date
  159.         self.number = number
  160.         self.gender = gender
  161.  
  162.     def save(self):
  163.         cursor.execute("INSERT INTO visitor (id, name, last_name, birth_date, number, gender_id) VALUES (NULL, '{0}','{1}','{2}','{3}','{4}')".format(self.name, self.last_name, self.birth_date, self.number, self.gender))
  164.  
  165. class BookInVisitor(object):
  166.     def __init__(self, visitor_name, visitor_last_name, book_name, book_author, data_of_take, remove_of_data=''):
  167.         super(BookInVisitor, self).__init__()
  168.  
  169.         self.visitor_name = visitor_name
  170.         self.visitor_last_name = visitor_last_name
  171.         self.book_name = book_name
  172.         self.book_author = book_author
  173.         self.data_of_take = data_of_take
  174.         self.remove_of_data = remove_of_data
  175.  
  176. class Author(object):
  177.     def __init__(self, id = '', name = '', last_name = ''):
  178.         super(Author, self).__init__()
  179.  
  180.         self.id = id
  181.         self.name = name
  182.         self.last_name = last_name
  183.  
  184.     def save(self):
  185.         cursor.execute("INSERT INTO author (id, name, last_name) VALUES (NULL, '{0}', '{1}')".format(self.name, self.last_name))
  186.  
  187. class BookPerAuthor(object):
  188.     def __init__(self, book_id = '', author_id = ''):
  189.         super(BookPerAuthor, self).__init__()
  190.  
  191.         self.book_id = book_id
  192.         self.author_id = author_id
  193.  
  194.     def save(self):
  195.         cursor.execute("INSERT INTO book_has_author (book_id, author_id) VALUES ({0},{1})".format(self.book_id, self.author_id))
  196.  
  197. # user = 'Mike'
  198. # password = '123456'
  199.  
  200. lib = Library()
  201.  
  202. # user_input = input("Enter user: ")
  203. # password_input = input("Enter password: ")
  204.  
  205. # if user == user_input and password == password_input:
  206.  
  207. cursor.execute("SELECT * FROM gender")
  208. bk = cursor.fetchall()
  209. if len(bk) == 0:
  210.     lib.initialize_database()
  211.  
  212. cursor.execute("SELECT * FROM author")
  213. au = cursor.fetchall()
  214. for author in au:
  215.     author = Author(author[0], author[1], author[2])
  216.     lib.authors.append(author)
  217.  
  218. cursor.execute("SELECT * FROM book")
  219. bk = cursor.fetchall()
  220. for book in bk:
  221.     # cursor.execute("SELECT id from book WHERE name = '{0}'".format(book[1]))
  222.     # b = cursor.fetchall()
  223.     b = book[0]
  224.     # print(b)
  225.     cursor.execute("SELECT author_id from book_has_author WHERE book_id = {}".format(b))
  226.     v = cursor.fetchall()
  227.     v = v[0][0]
  228.     # print(v)
  229.     cursor.execute("SELECT name FROM author WHERE id = {}".format(v))
  230.     na = cursor.fetchall()
  231.     na = na[0][0]
  232.     # print(na)
  233.     # print(book)
  234.     book = Book(book[0], book[1], na, book[2], book[3], book[4])
  235.     lib.books.append(book)
  236.  
  237. cursor.execute("SELECT * FROM visitor")
  238. vs = cursor.fetchall()
  239. for visitor in vs:
  240.     gender_name = visitor[5]
  241.     # print(gender_name)
  242.     cursor.execute("SELECT name FROM gender  WHERE id = {}".format(gender_name))
  243.     gender = cursor.fetchall()
  244.     gender = gender[0][0]
  245.     # print(gender)
  246.     visitor = Visitor(visitor[0], visitor[1], visitor[2], visitor[3], visitor[4], visitor[5])
  247.     lib.visitors.append(visitor)
  248.     # print(visitor)
  249.  
  250. cursor.execute("SELECT * FROM book_in_visitor")
  251. bookinvisitor = cursor.fetchall()
  252. for bkinvs in bookinvisitor:
  253.     """айді списка"""
  254.     idfirst = bkinvs[0]
  255.     # cursor.execute("SELECT taking_date FROM book_in_visitor WHERE id = {}".format(idfirst))
  256.     # takingdate = cursor.fetchall()  # takingDate, TakingDate, taking_date
  257.     # takingdate = takingdate[0][0]
  258.     takingdate = str(bkinvs[1])
  259.     # print(takingdate)
  260.     # cursor.execute("SELECT returning_date FROM book_in_visitor WHERE id = {}".format(idfirst))
  261.     # returningdate = cursor.fetchall()
  262.     # returningdate = returningdate[0][0]
  263.     returningdate = str(bkinvs[2])
  264.     # print(returningdate)
  265.     # cursor.execute("SELECT visitor_id FROM book_in_visitor WHERE id = {}".format(idfirst))
  266.     # """берем число в вісітора_айді"""
  267.     # visid = cursor.fetchall()
  268.     # visid = visid[0][0]
  269.     visid = str(bkinvs[3])
  270.     cursor.execute("SELECT name FROM visitor WHERE id = {}".format(visid))
  271.     """дістаєм імя"""
  272.     visname = cursor.fetchall()
  273.     visname = visname[0][0]
  274.     # print(visname)
  275.     cursor.execute("SELECT last_name FROM visitor WHERE id = {}".format(visid))
  276.     """дістаєм прізвище"""
  277.     vislastname = cursor.fetchall()
  278.     vislastname = vislastname[0][0]
  279.     # print(vislastname)
  280.     # cursor.execute("SELECT book_id FROM book_in_visitor WHERE id = {}".format(idfirst))
  281.     # """берем число бук_айді"""
  282.     # bookid = cursor.fetchall()
  283.     # bookid = bookid[0][0]
  284.     bookid = str(bkinvs[4])
  285.     # print(bookid)
  286.     cursor.execute("SELECT name FROM book WHERE id = {}".format(bookid))
  287.     bookname = cursor.fetchall()
  288.     bookname = bookname[0][0]
  289.     # print(bookname)
  290.     cursor.execute("SELECT author_id FROM book_has_author WHERE book_id = {}".format(bookid))
  291.     authorid = cursor.fetchall()
  292.     authorid = authorid[0][0]
  293.     # print(authorid)
  294.     cursor.execute("SELECT name FROM author WHERE id = {}".format(authorid))
  295.     authorname = cursor.fetchall()
  296.     authorname = authorname[0][0]
  297.     # print(authorname)
  298.     # cursor.execute("SELECT last_name FROM author WHERE id = {}".format(authorid))
  299.     # authorlastname = cursor.fetchall()
  300.     # authorlastname = authorlastname[0][0]
  301.     # print(authorlastname)
  302.     bookvisitor = BookInVisitor(visname, vislastname, bookname, authorname, takingdate, returningdate)
  303.     lib.history.append(bookvisitor)
  304.  
  305.  
  306. # book1 = Book(None, '300 spartans', 'Zak Plahin', '2001')
  307. # lib.add_book(book1)
  308.  
  309. # visitor1 = Visitor(None, 'Oleg', 'See', '12-12-2001', '+380635887884', 'male')
  310. # lib.add_visitor(visitor1)
  311. #
  312. # visitor2 = Visitor(None, 'Chak', 'Broflovski', '09-11-2001', '+38073911112', 'male')
  313. # lib.add_visitor(visitor2)
  314.  
  315.  
  316.  
  317. while True:
  318.     number = int(input('1 - Show all books\n2 - Show all visitors\n3 - Add visitor\n4 - Add book\n5 - Show author\n6 - Change visitor\n7 - Write book on visitor\n8 - Add remove date\n9 - Show history\n10 - Serch book by name\n11 - Search book by author\n12 - Show books in visitor\n:'))
  319.     if number == 1:
  320.         if len(lib.books) == 0:
  321.             print('Our library has not book')
  322.         for i in lib.books:
  323.             print(str(i.id) + ' Book: ' + i.name +', author: ' + i.author + ', date: ' + str(i.date))
  324.     elif number == 2:
  325.         if len(lib.visitors) == 0:
  326.             print('Our library has not visitors')
  327.         for i in lib.visitors:
  328.             cursor.execute("SELECT name FROM gender WHERE id = '{}'".format(i.gender)) # дістав назву статі із бази данних(id)
  329.             gender = cursor.fetchall()
  330.             gender = gender[0][0] # дістав з кортежу стать в правильному вигляді
  331.             print('ID: ' + str(i.id) + ', Name: ' + i.name + ', last name: ' + i.last_name + ', birth date: ' + str(i.birth_date) + ', number: ' + str(i.number) + ', gender: ' + gender)
  332.     elif number == 3:
  333.         first_name = input('Enter name: ')
  334.         first_name = first_name.capitalize()
  335.         second_name = input('Enter last_name: ')
  336.         second_name = second_name.capitalize()
  337.         birth_date = input('Enter birth date(yyyy-mm-dd): ')
  338.         number = int(input('Enter your number(380** *** *** *): '))
  339.         gender = input('Enter: 1-male / 2-female: ')
  340.         if gender == str(1):
  341.             cursor.execute("select name from gender where id = '{}'".format(1))
  342.             sex = cursor.fetchall()
  343.             sex = sex[0][0]
  344.             # print(sex)
  345.         elif gender == str(2):
  346.             cursor.execute("select name from gender where id = '{}'".format(2))
  347.             sex = cursor.fetchall()
  348.             sex = sex[0][0]
  349.             # print(sex)
  350.         else:
  351.             print('Error: gender_id!')
  352.             break
  353.         visit = Visitor(None, first_name, second_name, birth_date, number, gender)
  354.         if lib.add_visitor(visit) == False:
  355.             break
  356.         visit.save()
  357.         cursor.execute("SELECT last_insert_id()")
  358.         vid = cursor.fetchall()
  359.         db.commit()
  360.         # print(vid)
  361.         visit.id = vid[0][0]
  362.         # lib.add_visitor(visit)
  363.     elif number == 4:
  364.         name_book = input('Enter book name: ')
  365.         name_book = name_book.capitalize()
  366.         author_name = input('Enter author name: ')
  367.         author_name = author_name.capitalize()
  368.         author_last_name = input('Enter author last name: ')
  369.         author_last_name = author_last_name.capitalize()
  370.         found = False
  371.         for author in lib.authors:
  372.             if author.name == author_name and author.last_name == author_last_name:
  373.                 found = True
  374.                 aid = author.id
  375.                 db.commit()
  376.         if not found:
  377.             author = Author(None, author_name, author_last_name)
  378.             author.save()
  379.             cursor.execute("Select last_insert_id()")
  380.             aid = cursor.fetchall()
  381.             aid = aid[0][0]
  382.             # print(aid)
  383.             author.id = aid
  384.             lib.authors.append(author)
  385.             db.commit()
  386.         for book in lib.books:
  387.             if book.name == name_book:
  388.                 found = True
  389.                 print('This book exist')
  390.         if not found:
  391.             date = input('Enter date(yyyy-mm-dd): ')
  392.             count = int(input('Enter count:'))
  393.             available_count = count
  394.             # print(available_count)
  395.             # print(count)
  396.             bok = Book(None, name_book, author_name, date, count, available_count)
  397.             bok.save()
  398.             cursor.execute("SELECT last_insert_id()")
  399.             bid = cursor.fetchall()
  400.             bid = bid[0][0]
  401.             db.commit()
  402.             book_per_author = BookPerAuthor(bid, aid)
  403.             book_per_author.save()
  404.             db.commit()
  405.             bok.id = bid
  406.             lib.add_book(bok)
  407.     elif number == 5:
  408.         if len(lib.authors) == 0:
  409.             print("Author do not exist")
  410.         for i in lib.authors:
  411.             print('ID:', i.id, ',' + 'name author: ' + i.name + ', last name: ' + i.last_name)
  412.     elif number == 6:
  413.         old_name = input('Enter old name of visitor: ')
  414.         old_name = old_name.capitalize()
  415.         old_last_name = input('Enter old last name of visitor: ')
  416.         old_last_name = old_last_name.capitalize()
  417.         old_number = int(input('Enter old number of visitor: '))
  418.         if lib.user_exist(old_name, old_last_name, old_number) == False:
  419.             break
  420.         else:
  421.             new_name = input('Enter new name visitor: ')
  422.             new_name = new_name.capitalize()
  423.             new_last_name = input('Enter new last name visitor: ')
  424.             new_last_name = new_last_name.capitalize()
  425.             new_number = input('Enter new number visitor: ')
  426.             if new_number != int():
  427.                 print('Error int number!')
  428.                 break
  429.             cursor.execute("UPDATE visitor SET name = '{0}', last_name = '{1}', number = '{2}' WHERE number = '{3}'". format(new_name, new_last_name, new_number, old_number))
  430.             db.commit()
  431.             if new_last_name == '':
  432.                 lib.edit_visitors(old_name, old_last_name, old_number, new_name, old_last_name, new_number)
  433.             elif new_name == '':
  434.                 lib.edit_visitors(old_name, old_last_name, old_number, old_name, new_last_name, new_number)
  435.             elif new_number == '':
  436.                 lib.edit_visitors(old_name, old_last_name, old_number, new_name, new_last_name, old_number)
  437.             else:
  438.                 lib.edit_visitors(old_name, old_last_name, old_number, new_name, new_last_name, new_number)
  439.     elif number == 7:
  440.         visitor_name = input('Enter visitor name: ')
  441.         visitor_name = visitor_name.capitalize()
  442.         visitor_last_name = input('Enter visitor last name: ')
  443.         visitor_last_name = visitor_last_name.capitalize()
  444.         vis = lib.find_visitor_by_name(visitor_name, visitor_last_name)
  445.         data_take = input('Enter data take(yyyy-mm-dd): ')
  446.         if vis == None:
  447.             print('Enter again visitor')
  448.             break
  449.         else:
  450.             book_name = input('Enter book name: ')
  451.             book_name = book_name.capitalize()
  452.             book_author = input('Enter author name: ')
  453.             book_author = book_author.capitalize()
  454.             bo = lib.find_book_by_name(book_name, book_author)
  455.             if bo == None:
  456.                 print('Enter again book')
  457.                 break
  458.             else:
  459.                 cursor.execute("SELECT available_count FROM book WHERE name = '{}'".format(book_name))
  460.                 avcoif = cursor.fetchall()
  461.                 avcoif = avcoif[0][0]
  462.                 if avcoif == 0:
  463.                     print("This book is not available!")
  464.                 else:
  465.                     lib.write_book_visitor(vis, bo, data_take)
  466.                     cursor.execute("SELECT id FROM visitor WHERE name = '{0}' AND last_name = '{1}'".format(visitor_name, visitor_last_name))
  467.                     idvisitor = cursor.fetchall()
  468.                     idvisitor = idvisitor[0][0]
  469.                     # print(idvisitor)
  470.                     cursor.execute("SELECT id FROM book WHERE name = '{}'".format(book_name))
  471.                     idbook = cursor.fetchall()
  472.                     idbook = idbook[0][0]
  473.                     # print(idbook)
  474.                     cursor.execute("INSERT INTO book_in_visitor (id, taking_date, returning_date, visitor_id, book_id) VALUES (NULL, '{0}', {1}, {2}, {3})".format(data_take, 'NULL', idvisitor, idbook))
  475.                     cursor.execute("SELECT available_count FROM book WHERE id = {}".format(idbook))
  476.                     avco = cursor.fetchall()
  477.                     # print(avco)
  478.                     avco = avco[0][0]
  479.                     # print(avco)
  480.                     result = int(avco) - 1
  481.                     cursor.execute("UPDATE book SET available_count = '{0}' WHERE id = {1}".format(result, idbook))
  482.                     db.commit()
  483.     elif number == 8:
  484.         name1 = input('Enter visitor name: ')
  485.         name1 = name1.capitalize()
  486.         last_na = input('Enter last_name: ')
  487.         last_na = last_na.capitalize()
  488.         if lib.find_visitor_by_name(name1, last_na) == None:
  489.             print("This visitor not exist")
  490.             break
  491.         else:
  492.             book = input('Enter book: ')
  493.             book = book.capitalize()
  494.             author = input('Enter author: ')
  495.             author = author.capitalize()
  496.             if lib.find_book_by_name(book, author) == None:
  497.                 print("This book not exist")
  498.                 break
  499.             else:
  500.                 data = input('Enter data remove(yyyy-mm-dd): ')
  501.                 cursor.execute("SELECT name FROM book")
  502.                 bookname = [row[0] for row in cursor.fetchall()]
  503.                 # print(bookname)
  504.                 cursor.execute("SELECT id FROM visitor WHERE name = '{0}' AND last_name = '{1}'".format(name1, last_na))
  505.                 mid = cursor.fetchall()
  506.                 mid = mid[0][0]
  507.                 # print(mid)
  508.                 for i in bookname:
  509.                     if i == book:
  510.                         cursor.execute("UPDATE book_in_visitor SET returning_date = '{0}' WHERE visitor_id = {1}".format(data, mid))
  511.                         cursor.execute("SELECT available_count FROM book WHERE name = '{}'".format(book))
  512.                         avbo = cursor.fetchall()
  513.                         avbo = avbo[0][0]
  514.                         result = int(avbo) + 1
  515.                         cursor.execute("UPDATE book SET available_count = '{0}' WHERE name = '{1}'".format(result, book))
  516.                         db.commit()
  517.                         lib.add_data_of_remove(name1, last_na, book, author, data)
  518.     elif number == 9:
  519.         for i in lib.history:
  520.             print(i.visitor_name + ' ' + i.visitor_last_name + ' take: ' + i.book_name + ', author: ' + i.book_author + ', date: ' + str(i.data_of_take) + ', return: ' + str(i.remove_of_data))
  521.     elif number == 10:
  522.         i = input("Enter book name: ")
  523.         i = i.capitalize()
  524.         found = False
  525.         for book in lib.books:
  526.             if book.name == i:
  527.                 print('ID: ' + str(book.id) + ', Book: ' + book.name + ', Author: ' + book.author)
  528.                 found = True
  529.         if not found:
  530.             print("Not found")
  531.     elif number == 11:
  532.         i = input("Enter author name: ")
  533.         i = i.capitalize()
  534.         found = False
  535.         for book in lib.books:
  536.             if book.author == i:
  537.                 print('ID: ' + str(book.id) + ', Book: ' + book.name + ', Author: ' + book.author)
  538.                 found = True
  539.         if not found:
  540.             print("Not found")
  541.     elif number == 12:
  542.         name = input("Enter visitor name: ")
  543.         name = name.capitalize()
  544.         last_name = input("Enter visitor last name: ")
  545.         last_name = last_name.capitalize()
  546.         for i in lib.history:
  547.             if i.visitor_name == name and i.visitor_last_name == last_name and i.remove_of_data == 'None':
  548.                 print('Name: ' + i.visitor_name + ', last name: ' + i.visitor_last_name + ', book: ' + i.book_name + ', author: ' + i.book_author + ', date:' + i.data_of_take)
  549.  
  550. # lib = Library()
  551. #
  552. # book1 = Book()
  553. # book1.name = '300 spartans'
  554. # book1.author = 'Zak Plahin'
  555. #
  556. # book2 = Book()
  557. # book2.name = 'Hello'
  558. # book2.author = 'Jack Frans'
  559. #
  560. # book3 = Book()
  561. # book3.name = 'Madame Bovary'
  562. # book3.author = ''
  563. #
  564. # visitor1 = Visitor()
  565. # visitor1.name = 'Oleg'
  566. # visitor1.last_name = 'See'
  567. #
  568. # visitor2 = Visitor()
  569. # visitor2.name = 'Victor'
  570. # visitor2.last_name = 'Selo'
  571. #
  572. # visitor3 = Visitor()
  573. # visitor3.name = 'Victor'
  574. # visitor3.last_name = 'Selo'
  575. #
  576. # lib.add_visitor(visitor1)
  577. # lib.add_visitor(visitor2)
  578. # lib.add_visitor(visitor3)
  579. # lib.add_book(book2)
  580. #
  581. # lib.write_book_visitor(visitor2, book3)
  582. # lib.write_book_visitor(visitor1, book1)
  583. # lib.print_history()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement