dimanche 7 mars 2021

How can I shuffle two different lists in Python?

I want to shuffle two lists and combine them into one. But when I use random.shuffle(a, b) it throws me the traceback that the list object is not callable. How can I fix this problem and combine two lists? This is my code:

import random

alphabet = 'abcdefghijklmnopqrstuvwxyz'
numbers = '1234567890'

a = random.sample(list(alphabet), 3)
print(a)

b = random.sample(list(numbers), 3)
print(b)

c = random.shuffle(a, b)
print(c)



Aucun commentaire:

Enregistrer un commentaire