names = ['Bob', 'Jessica', 'Mary', 'John', 'Mel']
import random
random.seed(500)
random_names = [names[random.randint(low = 0, high = len(names))] for i in range(1000)]
Objective is to make a random list of 1,000 names using the five above. But the above code throws back the following error :
Traceback (most recent call last):
File "<pyshell#88>", line 1, in <module>
random_names = [names[random.randint(low = 0, high = len(names))] for i in range(1000)]
TypeError: randint() got an unexpected keyword argument 'low'
Aucun commentaire:
Enregistrer un commentaire