python cubic function code example Example: how to create a cubic function in python 3 def f(x): return 3*x**3 + 2*x**2 + 7*x + 1