(head, k)
return False
This is a suboptimal, hacky method using eval(), which is not
     safe for user input. We guard against danger by ensuring k in an int
This is a suboptimal, hacky method using eval(), which is not
     safe for user input. We guard against danger by ensuring k in an int
This is a suboptimal hacky method using eval () which is not safe for user input . We guard against danger by ensuring k in an int
def kth_to_last_eval(head, k):
    """
    This is a suboptimal, hacky method using eval(), which is not
     safe for user input. We guard against danger by ensuring k in an int
    """
    if not isinstance(k, int) or not head.val:
        return False

    nexts = '.'.join(['next' for n in range(1, k+1)])
    seeker = str('.'.join(['head', nexts]))

    while head:
        if eval(seeker) is None:
            return head
        else:
            head = head.next

    return False
def kth_to_last_eval ( head , k ) : if not isinstance ( k , int ) or not head . val : return False nexts = '.' . join ( [ 'next' for n in range ( 1 , k + 1 ) ] ) seeker = str ( '.' . join ( [ 'head' , nexts ] ) ) while head : if eval ( seeker ) is None : return head else : head = head . next return False