how to check if there is an element in the list without getting out of index error in python?
add_neighbours