私はこのPythonプログラミングを行い、問題を抱えています。 プログラムは、条件文に入れるときにn_zeroの値を呼び出すことはできません。式内の変数を呼び出すことができません
ここでプログラム
import numpy as np
n_zero=int(input('Insert the amount of 0: '))
n_one =int(input('Insert the amount of 1: '))
n_two =int(input('Insert the amount of 2: '))
n_three = int(input('Insert the amount of 3: '))
data = [0]*n_zero + [1]*n_one + [2]*n_two + [3]*n_three
print len(data)
if len(data)==(2(n_zero)-1):
np.random.shuffle(data)
datastring = ''.join(map(str, data))
print ("Data string is : %s " % datastring)
else:
print(error)
これは
if len(data)==(2(n_zero)-1):
TypeError: 'int' object is not callable
あなたは左を指定しないとあなたは左の値変数をキャストしていないあなたにPythonで
このエラーは、提供されたコードと一致しません。実際のコードを入力してください。 – Fejs
申し訳ありません。ここにエラーがあります。 'if len(data)==(2(n_zero)-1): TypeError: 'int'オブジェクトは呼び出し可能ではない' – jamarumori