Skip to content

Commit 84534e0

Browse files
mrmcwethymcscope
authored andcommitted
improved code sample
1 parent ba3a717 commit 84534e0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/randomcolor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
######################### HELPERS ##############################
1313

1414
# a random color 0 -> 224
15-
def rndc():
15+
def random_color():
1616
return random.randrange(0, 7) * 32
1717

1818
######################### MAIN LOOP ##############################
19-
n = len(dots)
19+
n_dots = len(dots)
2020
while True:
21-
#fill each dot with a random color1
22-
for dot in range(n):
23-
dots[dot] = (rndc(), rndc(), rndc())
21+
#fill each dot with a random color
22+
for dot in range(n_dots):
23+
dots[dot] = (random_color(), random_color(), random_color())
2424

2525
# show all dots in strip
2626
dots.show()

0 commit comments

Comments
 (0)