At specific focal length ranges, there are usually a couple of differently priced lens to choose from. That's where your budget comes into cosideration.
Another thing to take note, that if you want a lens fitted onto your D40x to AF, the lens must have an internal motor. For Nikon lenses, it is represented by AF-S / SWM. Sigma labels it as HSM etc. Other than those lenses, you will have to use Manual Focus because your D40x body has got no mechanical focus drive pin.