samedi 21 mars 2020

time and random module in python

I'm so basic in python my code work but the output is similar every time and it's not the correct answer

import datetime
import time
import random

odd = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33,
       35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]

minutee = datetime.datetime.today().minute
for i in range (5):     
     if minutee in odd:
          print ('odd')
     else:
          print('not odd')    
     wait_time= random.randint(1,40)    
     time.sleep(wait_time)  



Aucun commentaire:

Enregistrer un commentaire