我编写了一个解析给定输入的代码。我一直试图修复它大约三个小时。但我无法获得预期的产出。但是,我是堆栈使用和Java的新手。有人能帮我吗? from collections import defaultdict
sumdict = defaultdict(float)
for name, num, val in mylist:
sumdict[name, num] += float(val.replace(',', '.'))
# Side-note: I'd have used tuple/namedtuple for the triples here since the data likely
# shouldn't be mutable, and tuples are the "proper" type for fixed length,
# heterogeneous, immutable data, but the functional difference is minimal
summed = [[name, num, valsum] for (name, num), valsum in sorted(sumdict.items())]
预期产出:
Issue is fixed.
答案 0 :(得分:0)
在while (!stackCopy.Pop().Equals("("))
"("
之前您有2个令牌,因此idCon.Push("EXPI");
被调用了两次。结果条件if (temp.Equals("EXPI"))
被满足两次,并且"EXPI"
被打印在最后一行。