dimanche 25 juin 2023

how to add delay between two random choice python?

my code look like this :

import random
import time

number = '123'
items = ['one', 'two', 'three']

    n1 = str (random.choice(items ))
    n2 = str (random.choice(items ))
    n3 = str (random.choice(items ))

    choice = (n1+n2+n3)
        finalchoice = foo(choice)

how do add delay before item list value change ?

result script right now is :

one + random number 
two + random number 
three + random number 

what i want , script result is :

one + random number 
one + random number
one + random number

after 3 second, then thread change to

two + random number 
two + random number 
two + random number 
 

after 3 second, then thread change to

three + random number 
three + random number 
three + random number 

please help




Aucun commentaire:

Enregistrer un commentaire