Q:

Having 2 seperate infinite Loops

I want to recieve the keypresses of the User using msvcrt.getch, while I also want the program to write something to the screen every second. Thats my code:
while True:
    key = getch()        

    print("one second")
    sleep(1)

When I run it, it only continues writing one second to the screen when I press something.

A:

msvcrt also has a method called kbhit which is true if there is a char waiting to be read. So you can call that before reading the char.
while True:
    if kbhit():
        key = getch()

    print("one second")
    sleep(1)

