49339/python-error-python-can-t-assign-to-literal
I am trying to run very simple code in python.
I am getting an error on this
a = 2, b =4
The way you're assigning variables is not correct. This way is perfect for java or C but not for python. try something like this:
a, b, = 2, 4
or
a = 2 b = 4
Hope this helps!!
If you need to know more about Python, join Python certification course today.
Thanks!
Hey hola @Luis,
¿Podría por favor dar más detalles sobre lo que está tratando de hacer? ¿Para que pueda guiarte de la manera adecuada?
¿No se puede asignar un error literal en Python?
1 = valor es una asignación a un literal, lo que no tiene sentido
1, 2, 3, ... son identificadores no válidos en python porque, en primer lugar, son objetos enteros y, en segundo lugar, en python un nombre de variable no puede comenzar con un número.
La forma que ha asignado no es correcta, ya que el bucle debe usarse de manera diferente. He dado un ejemplo a continuación
row=[] for i in zip(row + k,k + row)]
The following are totally acceptable in python: passing ...READ MORE
For Python 2.6 and later and Python ...READ MORE
You can plot the chart by taking ...READ MORE
You need to set up the path ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
You can simply the built-in function in ...READ MORE
A TypeError can occur if the type ...READ MORE
Try specifying mingw as the compiler of choice. ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.