Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (19.9k points)

I am trying to run very simple code in python. 

I am getting an error on this

a = 2, b =4

But I am getting an error that says:

SyntaxError: can't assign to literal

How can i resolve this?

1 Answer

0 votes
by (25.1k points)

This is mainly due to a simple syntax error. You cannot assign values to python variables like this. I think the syntax you are looking for is this:

a, b = 2, 4

Or you can also do it like this:

a = 2

b = 4

To learn more about Python in depth you can watch this video on YouTube:

Browse Categories