Sorry but a carpet is way to big for a child of that age...
I agree with Ophi on this one.
Ball/Royal python.
They tend to be a species that will just curl into a ball when prodded/poked by young hands (and mine too

) rather than bite and are nice heavy bodied yet gentle snakes.
You'd be lucky if a female reached 5 with royals, and its unlikely a male will reach four, but it could happen so me thinks male.
This is my female
And this is my young male
And my young male pastel, I could see you having fun with this one, theyre gorgeous!
imo they are the perfect boid, small, yet plump and for the most part extremely tolerant and docile. You can see what I mean by the males curling into a ball in the pics, they just do that when they have had enough or are scared rather than biting. Theyre pretty tough snakes when it comes to handling and theres not much damage small hands can do.
Corn snakes almost always reach over 4' and although they arent fat snakes they are still very active and large snakes to be handled.
If a royal doesn't take your fancy perhaps a kenyan sand boa? Rosy boa perhaps? Or of course a spotted python but I definately would not go with a carpet python..they just get to big for a child that age. Although beautiful snakes to keep...I couldn't think of a worse pet to choose than an adult carpet python tame or not even in a few years when your childs abit older...
Hope this helped.