Keyboard input with timeout in while-loop [duplicate]

Code:

answer = None

def check():
    time.sleep(2)
    if answer != None:
        return
    print("Too Slow")

while True:
    current_kw = 0
    money = 100000  #100.000
    profit= current_kw * 300
    money += profit
    Thread(target = check).start()
    x = input('x: \n')
    ...

What I would like to achieve and what doesn't work:

Skip only works once instead of always

What I've tried:

See Code and Python 3 Timed Input



from Recent Questions - Stack Overflow https://ift.tt/3jo4voC
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations