Python solution of Linked_List part