Python solution ofLinked List part