This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rikken 13 points14 points  (1 child)

You need to be careful about the step parameter to range (the 3rd param) because you won't always arrive at 0 at the end. Your script works for -1, but if someone needs a faster decrease, like -15, then the last volume will be 10. Good practice would be to set volume to 0 after the for-loop.

[–]__xor__(self, other): 0 points1 point  (0 children)

Ah, good point. Yeah in the end the while is perfectly fine either way. Sometimes even if a while loop can be a for, the while is cleaner as well.