In [1]:
x = 20
print(x)


20

In [2]:
mylist = [-3, -2, -1, 0, 1, 2]
mylist.append(3)
print(mylist)


[-3, -2, -1, 0, 1, 2, 3]

In [3]:
cubes = [x**3 for x in mylist]
print(cubes)


[-27, -8, -1, 0, 1, 8, 27]

In [4]:
def myfunc(x):
    return 2*x**3 - 5*x**2 + 1
input = range(-2,6)
y = [myfunc(x) for x in input]
print(y)


[-35, -6, 1, -2, -3, 10, 49, 126]

In [5]:
import matplotlib.pyplot as plt
plt.plot(y)
plt.show()



In [ ]: