An electronic device comprising: a housing configured such that a stylus is detachably attached or inserted into the housing; a display viewed through a portion of the housing; at least one memory in the housing configured to store instructions; and at least one processor in the housing that is configured to execute the instructions to: while the display is in an inactive state or low power state and the electronic device is in a lock state, detect a detachment of the stylus, wherein the lock state is a state that limits functionality of the electronic device to only execute a part of functions supportable by the electronic device, in response to the detection, execute a memo application installed in the electronic device, in the lock state, receive at least one memo input using the memo application, in the lock state, temporarily store the memo input, in the lock state, receive an unlock input and determine whether the unlock input is effective, in the lock state, and in cases where the unlock input is effective, display a notification regarding the temporarily stored memo input in an unlock state, and while the electronic device is in the unlock state and content of a currently executed application is displayed on the display, detect a detachment of the stylus and execute the memo application, and separate the display into an area where the content is displayed and a memo area, or provide a transparent layer that provides a handwriting function on the content of the currently executed application. a housing configured such that a stylus is detachably attached or inserted into the housing; a display viewed through a portion of the housing; at least one memory in the housing configured to store instructions; and at least one processor in the housing that is configured to execute the instructions to: while the display is in an inactive state or low power state and the electronic device is in a lock state, detect a detachment of the stylus, wherein the lock state is a state that limits functionality of the electronic device to only execute a part of functions supportable by the electronic device, in response to the detection, execute a memo application installed in the electronic device, in the lock state, receive at least one memo input using the memo application, in the lock state, temporarily store the memo input, in the lock state, receive an unlock input and determine whether the unlock input is effective, in the lock state, and in cases where the unlock input is effective, display a notification regarding the temporarily stored memo input in an unlock state, and while the electronic device is in the unlock state and content of a currently executed application is displayed on the display, detect a detachment of the stylus and execute the memo application, and separate the display into an area where the content is displayed and a memo area, or provide a transparent layer that provides a handwriting function on the content of the currently executed application. while the display is in an inactive state or low power state and the electronic device is in a lock state, detect a detachment of the stylus, wherein the lock state is a state that limits functionality of the electronic device to only execute a part of functions supportable by the electronic device, in response to the detection, execute a memo application installed in the electronic device, in the lock state, receive at least one memo input using the memo application, in the lock state, temporarily store the memo input, in the lock state, receive an unlock input and determine whether the unlock input is effective, in the lock state, and in cases where the unlock input is effective, display a notification regarding the temporarily stored memo input in an unlock state, and while the electronic device is in the unlock state and content of a currently executed application is displayed on the display, detect a detachment of the stylus and execute the memo application, and separate the display into an area where the content is displayed and a memo area, or provide a transparent layer that provides a handwriting function on the content of the currently executed application.