Leetcode Design Hashmap Python Syntax If Then Else