class Solution(object): def clumsy(self, N): """ :type N: int :rtype: int """ op = {0: '*', 1: '//', 2: '+', 3: '-'} strN = list(map(str, range(N - 1, 0, -1))) ret = str(N) for i, s in enumerate(strN): ret += op[i % 4] + s return eval(ret)
class Solution(object): def clumsy(self, N): """ :type N: int :rtype: int """ op = {0: '*', 1: '//', 2: '+', 3: '-'} strN = list(map(str, range(N - 1, 0, -1))) ret = str(N) for i, s in enumerate(strN): ret += op[i % 4] + s return eval(ret)