What is entrapment, and when are police stings legal?

I hear others say police stings are in entrapment. I dunno what that means really. But many times stings have been done and courts ok’d them. All I know entrapment is illegal

What is entrapment, and when are police stings legal?
Post Opinion