Python code help

Question:
i want different delays depending on randomness but i doesn’t want to work
Repl link:
https://replit.com/@GreenIce13/Test
code snippet
Line 81-126

It’s working fine. Could you please explain what you’re trying to do better?

1 Like

it is in a loop and i want it to do the code once not 20 times

i want it to do it once per pokemon caught

You can generate a random delay based on the time you think it’s worth it.

# you generate a random delay between 0.5 and 3.5
    random_delay = random.uniform(0.5, 3.5)

    #and then you delay the next hunt
    print(f"Waiting for {random_delay:.2f} seconds before the next hunt...")
    time.sleep(random_delay)
    print(" ")