Python error "Python: can't assign to literal"

0 votes

I am trying to run very simple code in python. 

I am getting an error on this

a = 2, b =4
Jun 17 in Python by Ramya
120 views

1 answer to this question.

0 votes

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
answered Jun 17 by Priya

Related Questions In Python

0 votes
1 answer

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

The following are totally acceptable in python: passing ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,520 points
11,043 views
+1 vote
1 answer

How to print an error in Python?

For Python 2.6 and later and Python ...READ MORE

answered Aug 23, 2018 in Python by Priyaj
• 56,520 points
166 views
0 votes
1 answer

Pyplot error "only size-1 arrays can be converted to Python scalars"

You can plot the chart by taking ...READ MORE

answered Jan 28 in Python by Omkar
• 67,380 points
1,836 views
0 votes
1 answer

What to do when I get and error saying python not recognized as internal or external command?

You need to set up the path ...READ MORE

answered May 28 in Python by Fata
• 1,040 points
27 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 215 views
+4 votes
6 answers
0 votes
1 answer

Python error "TypeError: Can't convert 'int' object to str implicitly"

Hey Yamini, you cannot concatenate a string ...READ MORE

answered May 31 in Python by Gargi
218 views
0 votes
1 answer

Python error "error: Unable to find vcvarsall.bat"

Try specifying mingw as the compiler of choice. ...READ MORE

answered May 29 in Python by Imran
46 views