Leetcode Nonetype Object Has No Attribute Val