dimanche 5 juillet 2020

"'builtin_function_or_method' object has no attribute ' '

so ive been trying to randomly choose a number from my list "time" by using the random.choice(time) but it doesn't seem to work and gives me and error message saying "'builtin_function_or_method' object has no attribute 'choice'

from random import uniform, random, choice, sample, shuffle

num_passenger = range(1,51)
time = range(5,51)
num_passenger = list(num_passenger)
time = list(time)
shuffle(time)
time = random.choice(time)
for num_passenger in range(1,51):

    if(time <= 5 & time >= 15):
        print("{0} {0}".format(num_passenger, time))
    elif(time > 5 | time < 15):
        print("{0} {0}".format(num_passenger, time))



Aucun commentaire:

Enregistrer un commentaire