if (x>=0 and x<20) or (x>=40 and x<60)or (x>=80 and x<=100):
color = getColor(p)
else:
color=getColor(p2)
setColor(newPxl, color)
If your indentatin is right, you only setColor
in the else block. So the range from 0~20, 40~60, 80~100 will be blank.