while the script is running, it needs to be outside the input to catch the keyword and break the loop, I need to break the loop instantly with the 'esc' word, while the script waits for input by the user
¿how do i that?
import time ; import keyboard as kb
while (True):
if kb.is_pressed('esc'):
break
n = str(input('f(x) = '))
print(n)
time.sleep(1)
its a bit whim but the only way to stop the loop is to hold the 'esc' keyword and it would be more comfortable to press the key and instantly break the loop, i tried a few methods but they all lead to the same thing and this one is the most efficient