And if you are running just Python scripts directly in Rhino and not via Grasshopper then it looks like this:
Simple, starting at 1 and going to n layers (user input):
import rhinoscriptsyntax as rs
def AddNumberedLayers():
count=rs.GetInteger("Number of layers to add",minimum=1)
if count is None: return
for i in range(1,count+1):
layername="{}".format(i).zfill(3)
if not rs.IsLayer(layername): rs.AddLayer(layername)
AddNumberedLayers()
Allowing choice of start number and end number:
import rhinoscriptsyntax as rs
def AddNumberedLayersStartFin():
start_n=rs.GetInteger("Number to start with",minimum=0)
if start_n is None: return
end_n=rs.GetInteger("Number to end with",minimum=start_n+1)
if end_n is None: return
for i in range(start_n,end_n):
layername="{}".format(i).zfill(3)
if not rs.IsLayer(layername): rs.AddLayer(layername)
AddNumberedLayersStartFin()
These will not attempt to add an already existing same-numbered layer.
Note the layer color is determined by the default layer color set in Rhino. One can also give them all a specific color, or a random color or…
For a specific color one can simply replace the line
if not rs.IsLayer(layername): rs.AddLayer(layername)
with
if not rs.IsLayer(layername): rs.AddLayer(layername,rs.coercecolor([255,0,0]))
where the number in the square brackets represents the RGB color.
The number of leading zeroes can be controlled by changing the number in the parentheses .zfill(3)