The story begins when the Spanish Ambassador moves in next door. His son, Pepito, is not a good boy. Madeline dubs him a 'bad hat', due to the distinctive black hat he wears. The book is controversial due to the cruel nature of Pepito's mischief, such as killing a chicken. After he suffers from his own actions, Pepito reforms himself.
Pepito is slightly similar to Thomas1Edward2Henry3's fan character, Crovan (who was originally 87546 from the "Railway Series" books) as both were very arrogant and rude to the protagonists when they were first introduced, but they've both changed a lot. They are now on good terms with many of the protagonists, and they treat them with much more respect and compassion.
Although Pepito is Spanish, he has a pseudo-French accent in the cartoons, and uses both French and Spanish words.
Differences between the book and the special
- In the book, Madeline doesn't carry a red balloon in the beginning. In the special, when Madeline says "Bonjour" to Pepito, he pops the balloon using a slingshot.
- In the book, while the girls are doing their morning exercise one spring day, Pepito fires a rock from his slingshot at Madeline's butt. In the special, he fires a rock at Chloe's butt. This causes her to groan in pain and jump around.
- In the book, when Pepito gets bandaged after he does one of his naughty pranks only a doctor and nurse are seen rushing into his room. In the special, Doctor Cohn takes care of Pepito treating his injuries.
- In the book, when Pepito turns into a vegetarian, he goes shopping for vegetables. In the special, he gets vegetables for dinner and gives a bunny a carrot.
- In the book, when the girls go to the zoo, there are lions when Madeline tells Pepito that he's no longer a bad hat. In the special, Madeline says "Pooh Pooh" to the tiger in the zoo.
- In the end of the book, while the girls are brushing their teeth they wave goodnight to Pepito. In the special, Pepito brushes his teeth and smiles as a frog is seen on his head and croaks happily.