Python define function

The following Error Message shows up in the last ‘Plot’ procedure: In Z(Q), ‘numpy.float64’ object is not iterable.

I would like Z(Q) returns value that sum each i in the range (0, len(p)), which is a function with variable Q. And finally the plot is Q(X Axis) and Z(Q)(Y Axis) for each Q it can be plotted.

How can I modify Z(Q)? Thank you!

import numpy as np
import scipy.stats as stats
from scipy.stats import poisson, norm

cs = 100
co = 300
mu = 4.7

G = poisson(mu)
p = G.pmf(np.arange(3*mu))

Define Z(Q) function

def Z(Q):
for i in range(len(p)):
return sum(p[i]csmax((Q-i), 0) + p[i]comax((i-Q), 0))

Plot Q and (Q)

import pylab as pl

x = []
y = []

for Q in range(0, 12):

pl.plot(x, y, ‘-o’)

What product is this being used with?