0

多項式の合成除算を 4 次まで実行する簡単なプログラムを作成しようとしていますが、コードを実行しようとすると、R*A: Can't assign to operator と表示されます。掛け算の演算ができないということだと思いますが、なぜですか?私はプログラミングの経験が限られており、Java CompSci で 1 年しか経験していません。

print("This program assumes that the polynomial is to the 4th degree")
A = input('Input the first coefficient: ')
B = input('Input the second coefficient: ')
C = input('Input the third coefficient: ')
D = input('Input the fourth coefficient: ')
E = input('Input constant: ')
R = input('Input the divisor: ')
temp = 0

R*A = temp
#B + temp = temp
#R * temp = temp
#C + temp = temp
#R * temp = temp
#D + temp = temp
#R * temp = temp
#E + temp = temp

if temp == 0:
    print("It works!")
else:
        print("dang")

input('This is a shitty workaround for pause')
4

2 に答える 2

1

演算子を再割り当てしようとしているのではなく、乗算を行っているだけだと思います。

Python では、Java を含む他の多くの言語と同様に、割り当ては次のように行われます。

temp = R*A
于 2014-10-12T01:28:24.273 に答える