What is the purpose of a choke in a shotgun?

The choke in a shotgun is designed to shape how the shot spreads after you pull the trigger. That way you can gain more accuracy with your shots as well as better range. The choke is placed in the bore of the shotgun barrel, which is at the muzzle end. There are a two ways a choke gets installed into a shotgun. The screw-in chokes, which are easily replaceable and there are also fixed chokes that integrated into the shotgun barrel so that it is a part of the bore without being replaceable. So which ones are the best to use? Both are acceptable.