0
Good morning, everyone.
I have a master list called "Livros"
.
I need to draw a name from that list Livros
.
After choosing one of the names, I need to draw again, but now I need to choose from another list, and this second list has the name of the one that was drawn first.
To clarify.
on the List Livros
have ("Lucas" e "Isaias")
Suppose the random choice was Lucas
So my program has to make another random choice within that other call list Lucas
that has the values Lucas1 e Lucas2
.
Lastly, let’s suppose you enter "Lucas1" e "Lucas2"
was chosen the "Lucas1"
Downstairs I have a dictionary called "Lucas1", com as chaves "1", "2" e "3"
the last thing I want
It’s that my program chooses one of these keys and prints its value.
Chose "1" : "Text1"
I want you to print this..
Then I’ll adapt it to whatever I need.
I tried several ways, researched but could not find the solution. I thank all
#!/usr/bin/env python3
from random import *
#Turple Ordered and Unchangeable
Livros = ("Lucas", "Isaias")
Lucas = ("Lucas1", "Lucas2")
Isaias = ("Isaias1", "Isaias2")
Lucas1 = {
"1" : "Text1" ,
"2" : "Text2" ,
"3" : "Text3" ,
"4" : "Text4"
}
Lucas2 = {
"1" : "Text1" ,
"2" : "Text2" ,
"3" : "Text3" ,
"4" : "Text4"
}
Isaias1 = {
"1" : "Text1" ,
"2" : "Text2" ,
"3" : "Text3" ,
"4" : "Text4"
}
Isaias2 = {
"1" : "Text1" ,
"2" : "Text2" ,
"3" : "Text3" ,
"4" : "Text4"
}
print("How to Random ? ")
Did you do anything else or just create the lists and stuff?
– Tmilitino
I tried several things, tried some methods, but they didn’t work, they drew the list first correctly, but then in the second draw only brought me a letter... I researched , but nothing like what I’m trying to do. Summing up I tried and didn’t get anywhere, it was more complicated than I imagined it would be
– Luan Gabriel
for example here, he picks the first list and then he picks himself a letter from that book, but I didn’t want it like that.
LivroEscolha = choice(Livros)
print(LivroEscolha)

CapEscolha = choice(LivroEscolha)
print(CapEscolha)
– Luan Gabriel