Advertisement
aneliabogeva

Old books

May 13th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. favoriteBook = input()
  2. numberOfbooks = int(input())
  3. counter = 1
  4. bookIsFound = False
  5. nextbookName = input()
  6.  
  7. while counter <= numberOfbooks:
  8. if nextbookName == favoriteBook:
  9. bookIsFound = True
  10. break
  11. else:
  12. counter = counter + 1
  13. nextbookName = input()
  14.  
  15. if bookIsFound == False:
  16. print("The book you search is not here!")
  17. print(f"You checked {numberOfbooks} books.")
  18. else:
  19. print(f"You checked {counter-1} books and found it.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement