Home>
Question
I don't know why SyntaxError: can't assign to function call.
When the following code is executed, N_prices (n) = A * n + B * (len (str (n))) occurs.
nums = [int (e) for e in input (). split ()] #A, B, X
A, B, X = nums [0], nums [1], nums [2]
N_prices (n) = A * n + B * (len (str (n)))
if X<= N_prices (0):
print ('0')
if N_prices (10 ** 9)<= X:
print ('109')
for i in range (1, 10 ** 9):
if X<= N_prices (i) and X<= N_prices (i + 1):
print (str (i))

Answer # 1

Answer # 2
First, the syntax
N_prices (n) = A * n + B * (len (str (n)))
is strange. You cannot assign a value to a function.
Next, I get an error, simply because the functionN_prices
is not defined.
And since the variablen
is not defined, you need to recode it.Addition
As a guess, the questioner seems to have a mathematical syntax when trying to define a function.
In Python, when defining a function ...def function name (argument): processing return return value
Define it like this.
So in this case ...def N_prices (n): result = A * n + B * (len (str (n))) return result
The processing part is just a guess, but it looks like this.
Related articles
 python  i want to assign a trigonometric function in a numpy matrix
 python  i want to add an article category sorting function on the django blog
 processing using the len function when an integer value is obtained from python standard input
 python  i want to create a function that finds the standard deviation sigma from x, y
 please explain the function using the python dictionary
 python  i want to get rid of the error that the function is defined but not defined
 python  i'm looking for a method like the countif function in excel for pywin32
 python  i want to know the type of softmax function in pytorch
 python  with open syntaxerror: invalid syntax
 python  pass a variable to the websocket on_message function
 python  arguments are passed even though the function inside the function is not in parentheses
 python  i want to assign an element of one list to an element of another list
 how to assign to list when using python scraping find_all
 python 3x  i want to shorten the python function
 i want to create a function in python that all functions without class go through
 python  out of range of predict function used in image recognition (?)
 python  array elements cannot be used as function arguments ??
 i don't know the basic usage of the python generator function
 i want to create a function that calculates the absolute value in python
 python  excel function can be taken with get_as_dataframe
Trends
Selfsolved. It was caused by writing like a function definition.