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

    Self-solved. It was caused by writing like a function definition.

  • Answer # 2

    First, the syntaxN_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_pricesis not defined.
    And since the variablenis not defined, you need to recode it.

    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):
        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