I would like to receive randomized list values. In the 1st step, I want to receive a random language code and given that code in the 2nd step, I would like to receive a random value from a list based on the randomly selected language in the first step:
import random
lang = ["fr", "en"]
lang_choice = random.choice(lang)
print(lang_choice)
lang_fr = ["fr1", "fr2", "fr3"]
lang_en = ["en1", "en2", "en3"]
lang_choice_no = random.choice(lang_choice)
print(lang_choice_no)
Unfortunately, the output is only one character from the two words en
or fr
, for example, just e
. But it does not return (randomly), f.ex. en3
. How can I solve this?
Aucun commentaire:
Enregistrer un commentaire