Sichanov

old books

Jul 15th, 2021
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. searched_book = input()
  2. total_books_count = 0
  3. current_book = input()
  4. book_found = False
  5. while current_book != "No More Books":
  6.     if searched_book == current_book:
  7.         book_found = True
  8.         break
  9.     else:
  10.         total_books_count += 1
  11.         current_book = input()
  12. if book_found:
  13.     print(f"You checked {total_books_count} books and found it.")
  14. else:
  15.     print("The book you search is not here!")
  16.     print(f"You checked {total_books_count} books.")
Advertisement
Add Comment
Please, Sign In to add comment