Hello!
While I was working on this and that with what I learned, I thought I could randomly extract two lists at once and make a code, but in the A=tuple(a)
step, it said TypeError: 'NoneType' object is impossible'
and I'm looking for a master who can explain why. Thank you very much for your reply in advance!
import random
data1 = ["Ga", "Na", "Da", "La"]
data2 = ['a','b','c','d']
a= random.shuffle(data1)
b= random.shuffle(data2)
A= tuple(a)
dic = {A:b}
print(dic)
import random
data1 = ["Ga", "Na", "Da", "La"]
data2 = ['a','b','c','d']
random.shuffle(data1)
random.shuffle(data2)
dic = {a: b for a, b in zip(data1, data2)}
print(dic)
I think it'd be good to do it like this.
© 2024 OneMinuteCode. All rights reserved.