Advertisement
Guest User

Untitled

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