I've written the following block of code. The code is correct syntax wise but has some logical error that I can't find. The code takes in name, author and assigns a bool value to read based on user input. The while loop section has some logical error due to which the interpreter never get to while loop and hence add_book function fails as read has no value assigned.
name = input("Title: ").lower()
author = input("Author: ").lower()
has_read = input("Mark as Read (y/n): ").lower()
while has_read not in ['n', 'y']:
if has_read == 'y':
read = True
else:
read = False
add_book(name, author, read)