没用过Python,现学现卖,呜呜呜。
经过观察我们只要在’2’和’(‘之间加上’**’,然后再算整个式子的结果就行了?
t = input()
l = len(t)
ans = ""
for i in range(l):ans += t[i]if i == l - 1:breakif t[i] == '2' and t[i + 1] == '(':ans += "**"
ans = eval(ans)
print(ans)
经过观察我们只要在’2’和’(‘之间加上’**’,然后再算整个式子的结果就行了?
t = input()
l = len(t)
ans = ""
for i in range(l):ans += t[i]if i == l - 1:breakif t[i] == '2' and t[i + 1] == '(':ans += "**"
ans = eval(ans)
print(ans)