We can lock computer or laptop in two ways;
1: Windows button+L when you press windows button+L button your computer will be locked this is a short cut way for locking your computer!
2: is another method that is to press windows button after than select Microsoft profile button and select the lock option.
Both methods are guided in screen shot also: