with open('authors.txt', 'r') as file:
authorsList = file.read().splitlines()
with open('names.txt', 'r') as file:
namesList = file.read().splitlines()
booksList = []
namesList2 = []
authorsList2 = []
x = 0
for book in namesList:
x += 1
stripData = f'{x}. '
appendData = book.strip(stripData)
namesList2.append(appendData)
for x in range(0, len(authorsList)):
booksList.append(f' {authorsList[x]}, {namesList2[x]}')
def showAllBooks():
for book in booksList:
print(book)
def searchBook():
global bookAppears
print('Type a book\'s name')
print('Введите название книги')
print()
print()
searchingText = input()
x = 1
print()
print()
for book in booksList:
if searchingText in book:
print(f' {x}. {book}')
x += 1
bookAppears = True
if bookAppears == False:
print('Such book is not found')
print('Такая книга не найдена')
def start():
print('Starting...')
print('Запуск...')
print()
print('Type 1 if you want to view all books.')
print('Type 2 if you want to search a book.')
print()
print('Введите 1, если Вы хотите просмотреть все книги.')
print('Введите 2, если Вы хотите найти книгу.')
print()
message = input()
print()
if message == '1':
showAllBooks()
elif message == '2':
searchBook()
else:
print('Error')
print('Ошибка')
def main():
start()
bookAppears = False
main()
input()