You can obviously parametrize the sumthing as you please, if you want the A = 10 passed in as well.
def sumthing(A, n):
s = 0
for i in range(1, n+1):
s = s + i # elaborate calculation instead of i
return s
def entireFormula(A, n):
return A*n + sumthing(A, n)
I assumed the 10 in your original formula is the A you mention later, then you could call this with whatever you want for A and whatever for n. This formula is now reusable