0
私のコードに何が問題なのかを調べようとしています。それはAとBPythonでシャッフルの数値データを比較する
from math import floor
import random
count = 0;
a = '1 2 3'.split()
b = '3 2 1'.split()
def shuffler(x,y):
random.shuffle(x)
random.shuffle(y)
def compare_deck(x,y):
if x == y:
return False
else:
return True
while True:
shuffler(a,b)
compare_deck(a,b)
count += 1
continue
else:
print('It took {} times of shuffle to be the same
arrangement.'.format(count))
結果を使用しない場合、なぜcompare_deck()を呼び出すのに気をつけましたか? – jasonharper
@downshift 'count + = 1'はすべての繰り返しを実行する必要がありますが、問題は、これが抜ける方法がないため、これは無限ループです。 Joshua:あなたのループはいつまでに終了すると思いましたか?また、最後の 'continue'は*完全に無意味です*。 –