Q:

While loops for lists?

I'm pretty new to programming and I have a quick question. I am trying to make a Gaussian function for a range of stars. However i want the size of undercurve be at 100 for all the stars. I was thinking of doing a while loop saying that while the total length of undercurve be 100. However, I get an error and I'm guessing it has something to do with it being a list. I'm showing you guys my code to see if you can help me out here. Thanks!
I get a syntax error: can't assign to call function
import numpy
import random
import math
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import scipy
from scipy import stats
from math import sqrt
from numpy import zeros
from numpy import numarray

variance = input("Input variance of the star:")
mean = input("Input mean of the star:")

space=numpy.linspace(-4,1,1000)
sigma = sqrt(variance)

Max = max(mlab.normpdf(space,mean,sigma))
normalized = (mlab.normpdf(space,mean,sigma))/Max

def random_y_pt():
    return random.uniform(0,1)

def random_x_pt():
    return random.uniform(-4,1)

import random

def undercurve(size):
    result = []
    for i in range(0,size):
        y = random_y_pt()
        x = random_x_pt()
        if y < scipy.stats.norm(scale=variance,loc=mean).pdf(x):
            result.append((x))
    return result

size = 1

while len(undercurve(size)) < 100:
     undercurve(size) = undercurve(1)+undercurve(size)
     print undercurve(size)

plt.hist(undercurve(size),bins=20)
plt.show()

A:

If your error is something like SyntaxError: can't assign to function call then that's because of your line
undercurve(size) = undercurve(1)+undercurve(size)

Which is trying to set the output of the right-hand side as the value of undercurve(size), which you cannot do.  
It sounds like you actually want to see just the first 100 items in the list returned by undercurve(size).  For that, use
undercurve(size)[:100]

