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

+1 vote

I am trying to run very simple code in python. 

I am getting an error on this

a = 2, b =4
Jun 17, 2019 in Python by Ramya
5,196 views

1 answer to this question.

+1 vote

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, 2019 by Priya
thank you very much, I spent a lot of time stuck in this problem.
Glad to help.. Upvote the answer, if it's helped you :)

Related Questions In Python

+1 vote
6 answers
+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
• 57,530 points
598 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, 2019 in Python by Omkar
• 69,040 points
6,886 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, 2019 in Python by Fata
• 1,050 points
192 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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,089 views
0 votes
0 answers
+4 votes
6 answers
0 votes
2 answers

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

A TypeError can occur if the type ...READ MORE

answered Feb 5 in Python by lovelmark
• 160 points
1 flag 2,541 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, 2019 in Python by Imran
903 views