keep tracking time in while loop and interacting with other commands in python3
Question: So i created a while loop that the user input and an output is returned

    
    
    choice = input()
    while True:
        if choice == "Mark":
           print("Zuckerberg")
        elif choice == "Sundar":
           print("Pichai")
    

and i want to keep time so when i hit Facebook is going to keep time for FB
and when i type Google is going to keep time for google like this

    
    
    import time
    choice = input()
    while True:
        if choice == "Facebook":
           endb = time.time()
           starta = time.time()
        if choice == "google":
           enda = time.time()
           startb = time.time()
        if choice == "Mark":
           print("Zuckerberg")
        elif choice == "Sundar":
           print("Pichai")
    

if i make this like above when i get to print the elapsed time is going to
print the same number but is going to be minus instead of plus, and vice versa

    
    
    elapseda = enda - starta
    elapsedb = endb - startb
    print(elapseda)
    print(elapsedb)
    

How do i keep track of the time but be able to interact with my other
input/outputs?

Thanks

##############################################################################

Edit: Sorry for making it not clear. What i meant by tracking time it that
instead of print an output when you type a keyword is going to track time.
This will be used to take the possession time of a sport match but meanwhile
count other stats like Penalty Kicks and stuff. I cant post my code due to
character limit but here is an idea:

    
    
    while True:
       choice = input()
       if choice == "pk":
          print("pk")
       elif choice == "fk":
          print("fk")
       elif choice == "q":
          break
    

and in there i should put possession time but meanwhile i want to interact
with the others


Answer: In the while loop you could count seconds like so.

    
    
    import time
    a = 0
    while True:
        a = a + 1
        time.sleep(1)
    

That would mean that a is about how many seconds it look to do the while loop.

