How to write a function like f(y) = xy^3 in Python?


I want to write a function for f(y) = xy<sup>3</sup> in Python.

For instance, if I pass a value such as f(5) then it should give output as 125x. How to do it?

1 Answer

4 years ago by

You can do like below,

def f(y):
       return str(y**3) + 'x'

res = f(3)

print(res)

4 years ago by Divya