Law
Law is a system of rules that people try and follow in a society. It is sometimes expressed as ethics. If you ignore these rules you will receive punishment or pay a penalty. It is usually rules created by leaders to order that exchanges between people and groups are orderly and predictable. Sometimes it is created by groups of people such as one's neighbours or other people with which one may share some common characteristic.Because one's neighbours do not always have the best judgement, and because not every leader behaves according to what they say, it is dangerous to have a legal system that is arbitrary. Politics or religion are usually the source of the principles upon which laws are based, as people trust the ideas based upon religion or politics.
A legal code is a code of conduct that is enforced by law. This may involve police and courts, and punishment.
A jurist is a professional who studies and argues the law. An ethicist is someone who usually works only within codes of conduct based upon principles that .
When leaders enforce the legal code honestly even on themselves and their friends, this is called rule of law. It's rare - but many people believe it is possible, even in a democracy.