mercredi 10 juillet 2019

How can I choose from list that generated randomly;?

import random

i=1
a = {}
a["Abdullah Gül Üniversitesi(Kayseri)"] = [1, 2, "bob"]
a["Abdullah Gül Üniversitesi2(Kayseri)"] = [3, 4, "bob2"]
a["Abdullah Gül Üniversitesi3(Kayseri)"] = [5, 6, "bob3"]
a["Abdullah Gül Üniversitesi4(Kayseri)"] = [7, 8, "bob4"]
key = random.choice(list(a))
print(key)

# it works until this

w=random.choice(dict(key))
print(w)

I want to generate a random list from a and it worked correctly but the thing is I can't generate a random value from the first one I created.




Aucun commentaire:

Enregistrer un commentaire