Feb-28-2019, 11:04 PM
Hello
I'm trying to write a little program for class, but I get an error saying "SyntaxError: can't assign to operator" and I don't know why that is.
The code I'm using:
The message I get when I run the code:
If anyone could tell my why I get this error, I would highly appreciate it
.
Thanks in advance,
Jomy
I'm trying to write a little program for class, but I get an error saying "SyntaxError: can't assign to operator" and I don't know why that is.
The code I'm using:
n = int (input ('Getal waarvan je het kwadraat wil berekenen: ')) x = 1 kwadraatx = 1 kwadraatxmin1 = 0 while (x < n): kwadraatx - kwadraatxmin1 + 2 = verschil2 kwadraatxplus1 = verschil2 + kwadraatx kwadraatxmin1 = kwadraatx kwadraatx = kwadraatxplus1 x = x + 1 else: kwadraatx - kwadraatxmin1 + 2 = kwadraatxplus1 print ('oplossing: Het kwadraat van ' + str(n) + 'is ' + str(kwadraatxplus1))
The message I get when I run the code:
Error:input
File "/home/main.py", line 6
kwadraatx - kwadraatxmin1 + 2 = verschil2
^
SyntaxError: can't assign to operator
If anyone could tell my why I get this error, I would highly appreciate it

Thanks in advance,
Jomy