Question: Using the following code: 

```
   >>> import time
   >>> start = time.time()
   >>> end = time.time()
   >>> end - start

```

one can measure time between "start" and "end". What about measuring the time between specific keystrokes? Specifically, if a module was run and the user started typing something, how can python measure the time between the **first** keystroke and the **enter key**. Say I ran this script and it said: "Please enter your name, then press enter: ". I write Nico, and then press enter. How can I measure time between "N" and the enter key. This should be in seconds, and after pressing enter, the script should end.

Answer: 
A simple way you could do that is:

```
from time import time
begin = time.time()
raw_input() #this is when you start typing
#this would be after you hit enter
end = time.time()
elapsed = end - begin
print elapsed
#it will tell you how long it took you to type your name

```
On Windows you can you [msvcrt.kbhit()](http://docs.python.org/library/msvcrt.html#msvcrt.kbhit) to tell when a key has been pressed. See <http://effbot.org/librarybook/msvcrt.htm> for a worked-out example.