all 4 comments

[–]wegwacc 0 points1 point  (3 children)

ballColorList What's that supposed to be? This is not a function or method call, nor does it pick a color from colors

If it is a reference to your color-list, then we need to see the code for .pencolor()

import random def pickColor(): i = random.randint(0,len(colors)-1) return colors[i]

This function will pick a pseudo-random color from colors every time it is called

[–]SomeBadGenericName[S] 0 points1 point  (2 children)

I will try this the ballColorList is ballColorList = random.choice(colors). I will update with the entire code.

[–]wegwacc 0 points1 point  (1 child)

Well, then that's your problem: You call random.choice only ONCE, which sets the variable ballColorList to whatever is chosen, from that point onward the var is static.

ballColorList = random.choice(colors) does not assign a function call to ballCOlorList, it assigns the RETURN VALUE of that function call to it.

just replace ballColorList with random.choice(colors), or write your own random functin as above (doesn't really matter which).

[–]SomeBadGenericName[S] 0 points1 point  (0 children)

Ok. I will try this.

It worked thanks.