Coolio pled guilty to possession of a concealed weapon but will avoid jail time ... TMZ has learned.
The rapper was in an L.A. court Wednesday where he was placed on 3 year probation and ordered to 45 days of community service. He must remain on his best behavior -- which includes not using or carrying a gun. If he does that for a year, the charge will be reduced to a misdemeanor.
TMZ broke the story ... Coolio was yanked off a plane back in September after TSA found the gun in a book bag ... one of his crew members tried to take the fall, but cops searched the bag and it wasn't hard to determine it was the rapper's.
But it wasn't all bad news in court ... before ending his hearing, the judge turned to the rapper and told him, "You've got a different little hair style ... it suits you."