close

[Solved] SyntaxError: “can’t assign to function call”

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error SyntaxError: “can’t assign to function call” in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How SyntaxError: “can’t assign to function call” Error Occurs?

Today I get the following error SyntaxError: “can’t assign to function call” in python.

How To Solve SyntaxError: “can’t assign to function call” Error ?

  1. How To Solve SyntaxError: “can't assign to function call” Error ?

    To Solve SyntaxError: “can't assign to function call” Error You wrote the assignment backward: to assign a value (or an expression) to a variable you must have that variable at the left side of the assignment operator ( = in python )

  2. SyntaxError: “can't assign to function call”

    To Solve SyntaxError: “can't assign to function call” Error You wrote the assignment backward: to assign a value (or an expression) to a variable you must have that variable at the left side of the assignment operator ( = in python )

Solution 1


You are assigning to a function call:

invest(initial_amount,top_company(5,year,year+1)) = subsequent_amount

which is illegal in Python. The question is, what do you want to do? What does invest() do? I suppose it returns a value, namely what you’re trying to use as subsequent_amount, right?

If so, then something like this should work:

amount = invest(amount,top_company(5,year,year+1),year)

Solution 2

You wrote the assignment backward: to assign a value (or an expression) to a variable you must have that variable at the left side of the assignment operator ( = in python )

subsequent_amount = invest(initial_amount,top_company(5,year,year+1))

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read