sibinasto

10.01. Old Books

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