Clean code tip - Don't use magic numbers
Python Clean Code Tip:
Don't use "magic numbers".
Magic numbers are strange numbers that appear in code, which do not have a clear meaning.
👇
import random # This is bad def roll(): return random.randint(0, 36) # what is 36 supposed to represent? # This is good ROULETTE_POCKET_COUNT = 36 def roll(): return random.randint(0, ROULETTE_POCKET_COUNT)
Instead of using magic numbers, extract them into a meaningful variable.