mercredi 30 juin 2021

Python command repeats same number in command(im learning python)

I tried to make a twitter bot to print random number but it print the same number while testing the command

import tweepy
import random
import time
import threading
import schedule



start = time.perf_counter()
while time.perf_counter() - start < 2:
    random_number = random.randint(0,10000)
    time.sleep(1.0)



def job():  
    print(random_number)  

# run the function job() every 2 seconds  
schedule.every(2).seconds.do(job)  

while True:  
    schedule.run_pending() 

What should I do in order to have random numbers?




Aucun commentaire:

Enregistrer un commentaire