I'm new to programming in general and this is my first post here, so please explain like I'm five. This is a random string combination generator (sorry if I don't know how to call it properly) and I want to make the program start counting time since A key is first pressed until Q is pressed, without counting repeats caused by pressing A. I also know that this might come handy, but I don't really know how to make it work. Here's the code:
import random
import os
print('hello world')
while True:
    while True:
        key = msvcrt.getch().lower()
        if key == b'a':
            os.system('cls')
            alpha = random.randint(1, 2)
            bravo = random.randint(1, 2)
            if alpha == 1:
                print('foo')
            elif alpha == 2:
                print('bar')
            if bravo == 1:
                print('spam')
            elif bravo == 2:
                print('eggs')
        elif key == b'q':
            os.system('cls')
            print('elapsed time: mm:ss')   #this is where i want to have shown time elapsed from pressing A for the first time until pressing Q
            break
 
    