を与えていない私は上記のコードを実装する場合、同じセット変異、なぜ以下のコードは、私はちょうど、セットの変異を実装しようとし、次の午前私に望ましい結果
a=raw_input()
setA=set(list(map(int,raw_input().split())))
N=int(raw_input())
for i in range(N):
operation=raw_input().split()
setB=set(list(map(int,raw_input().split())))
if 'update' in operation[0]:
setA.update(setB)
elif 'intersection_update' in operation[0]:
setA.intersection_update(setB)
elif 'symmetric_difference_update' in operation[0]:
setA.symmetric_difference_update(setB)
elif 'difference_update' in operation[0]:
setA.difference_update(setB)
print sum(setA)
のコードで、私通知は更新以外の指示は実際には実装されていません... 誰かが私の理由を説明することができます! 入力は=、それらの間のスペースを持つ文字列が 出力密接にこのコードスニペットを見て
:だから私はこれをしようと提案しますか?だから、あなたのエリフは決して実行されません。 –
'operation [0]'にはどのような値がありますか? '' update '== operation [0] 'ではなく、operation [0]'で '' update' 'をテストするのはなぜですか? –
ありがとう@PeterWood :) – deb