From what I know about them, the d50 and the d40 are two different things. The d40 is designed to be a point and shoot type camera (not meant for as serious photography as the d50). The d50 is designed as a more affordable version of the d70 (my camera, which I love) so it has a little lower quality and less features (ie wireless remote and flash). If you're trying to become or you are a pretty serious photographer you'll be frustrated with the d40 since it's not designed for that and so it doesn't have some of the features that you might want.
There's a decent review here that compares the two, the same website has a review of the d50 that compares it to the d70.
http://www.dpreview.com/reviews/nikond40/
Edit: if you're wondering about lenses, a good beginner lens is somewhere between 50-150. Less than 50 is more of a normal lens length but if you try to take portraits with something short like that you'll notice distortion. I find a lot of beginners like lenses in this area. You can branch out from there.