Counter.update() 函数需要两个参数(数据及其键),我提供了两个参数,但它抱怨提供了三个参数。
from collections import Counter
InputString1 = input()
InputString2 = input()
Set1 = Counter()
Set2 = Counter()
for i in range(len(InputString1)):
arg1 = InputString1.count(InputString1[i])
Set1 = Set1.update(InputString1[i], arg1)
for i in range(len(InputString2)):
arg2 = InputString2.count(InputString2[i])
Set2 = Set2.update(InputString2[i], arg2)
Temp = Set1
Temp.subtract(Set2)
TotCount = sum(Temp.values())
Temp = Set2
Temp.subtract(Set1)
TotCount = TotCount + sum(Temp.values())
print(TotCount)
Traceback (most recent call last):
File "pallidromemake.py", line 8, in <module>
Set1 = Set1.update(InputString1[i], arg1)
TypeError: update() takes from 1 to 2 positional arguments but 3 were given