Advertisement
simeonshopov

Old book

Oct 7th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. book = input()
  2. capacity = int(input())
  3. checked = 0
  4. next_book = input()
  5. is_found = False
  6.  
  7. while checked <= capacity:
  8.   if next_book == book:
  9.     is_found = True
  10.     break
  11.   checked += 1
  12.   if checked == capacity:
  13.     break
  14.   next_book = input()
  15.  
  16. print(f"You checked {checked} books and found it."
  17.       if is_found == True else f"The book you search is not here!\nYou checked {capacity} books.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement