I can't work out why when i try to print the list(listProb....s) it prints the empty list, i'm not setting them to the empty list after this code or anything, and when i print the normDistProb's on their own it prints fine):

for i in range(0,12):
listProbFog.append(normDistProb(dayValues[i], fogAve[i], fogVar[i]))
listProbSnow.append(normDistPr...ob(dayValues[i], snowAve[i], snowVar[i]))
listProbRain.append(normDistProb(dayValues[i], rainAve[i], rainVar[i]))
listProbNone.append(normDistProb(dayValues[i], noneAve[i], noneVar[i]))

Thanks

p.s. listProb's are indented

Recommended Answers

All 4 Replies

What does the function normDistProb return? The first attempt to debug this should be to print it

for i in range(0,12):
    listProbFog.append(normDistProb(dayValues[i], fogAve[i], fogVar[i]))
    print normDistProb(dayValues[i], fogAve[i], fogVar[i])
    print listProbFog
    # the other lists are just extra cruft until you get this problem solved
commented: agree +7

Maybe the listProb lists have already an empty list inside after entering the loop. You can print their content before entering the loop.

I guess that normDistProb returns an empty list somehow.

i got it - my normDistProb functioned looped popping elements from the list so it worked whilst inside the loop and the desired results were obtained, so basically there was no way anyone could answer this question with the information i provided, sorry!

You should mark this thread solved, even you solved it yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.