This is very easy. have a look at the following code - 
>>> def f(y):
       return str(y**2) + 'x'
>>> f(9)
'81x'
And if you have the value of constant then 
def f(y):
  x=2
  return x*(y**2)
>>> f(2)
8
>>> 
Suppose you have a polynomial equation such as 
p(x)=x4−4⋅x2+3⋅xp(x)=x4−4⋅x2+3⋅x then in this case :
>>> def p(x):
    return x**4 - 4*x**2 + 3*x
>>> p(2)
6