Most customers who end up locked out of their house, could prevent this from happening. The leading cause is having both a deadbolt and key operated knob on the same door. The door knob lock is bumped on the way out and you have a problem. The actual security device is the deadbolt. Having a key operated lock on the same door is an accident waiting to happen. You can only lock a deadbolt from outside with the key.
The cheapest solution is to change the knob to one that does not lock, known as a passage lock. Hiding a spare key in your car or near your house is also an alterative. Please be creative if you are hiding a key. Thieves know to look under the doormat or in your mailbox. Duplicate keys are far less expensive than calling a locksmith.
Never use a lock that mounts on the inside of the door looking like a box that performs a similar function as a deadbolt but have a sprig loaded latch. Most of these locks have a button on the lock as well as the knob to turn the lock. when the button is accidentally bumped, the lock cannot be opened with a key. Many times I find this type of lock on apartments that have no other means of entrance. Being locked out with one of these locks will be very expensive, as only destructive methods can be used to gain entry. Always buy a high quality deadbolt such as a Schlage or Kwikset. We receive numerous calls from people locked in thier apartment when a cheap deadbolt fails in the locked position.