I'm trying to create a quick program that'll do synthetic division for polynomials to the 4th degree, but when I try and execute my code, it'll tell me R*A: Can't assign to operator. I assume that means it can't do the operation of multiplication, but why? I have limited experience in programming, just one year in Java CompSci
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')
I assume you're not trying to re-assign an operator but just doing multiplication.
In python, like many other languages including Java, assignment is done like this:
temp = R*A
Temp = R * A
Your inputs will be str. You need to tell python it will be an int. int (input("...."))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.