Yes it punishes people who do wrong and makes them learn from their mistakes in such a way that they do not do it again
it is good that people learn mistakes to convert negative ideas to positive attitude in which gratitude helps

Yes it does... Punishing a person makes him realize what he did was wrong. Also when giving a man a punishment others become afraid to do the wrong the other man did example.. At school achild suppose bullied a child sand he is punished ' the other students would be afraid to do the same mistake because they are afraid whether they would aslsdo be punished