Sep-18-2018, 12:27 PM
Hey guys,
I'm trying to make a function that detects if the user is "afk" for about 5 seconds, and than exits the code.
would like some help :)
I'm trying to make a function that detects if the user is "afk" for about 5 seconds, and than exits the code.
would like some help :)
import random import time import math def Dice(): dice = random.randint(1, 6) dice2 = random.randint(1, 6) return(dice, dice2); def Start(x): y = int(x) + int(5) #Adding 5 seconds to the time user_input = input(">>> ") if user_input: print("Your Dice rolls are", Dice()) Start(math.floor(time.time())) while y < math.floor(time.time()): #This doesn't work print("Its too late") exit() def Ready(): print("To start send any value") Start(math.floor(time.time())) Ready()Thanks