- 1

Can we use random choice in dictionary?

1st May 2020, 6:15 AM
Praneet Negi
Praneet Negi - avatar
5 Answers
+ 3
Without even specifying which programming language you are talking about, your question is too broad. Please tag the language. If you ask about python, you can pick a random value from a dict like: random.choice(mydict.values())
1st May 2020, 6:28 AM
Tibor Santa
Tibor Santa - avatar
0
Yes, you can. Anyway if you want a meaningful answer, post your code you have trouble with, or ask a more specific question.
1st May 2020, 6:21 AM
Tibor Santa
Tibor Santa - avatar
0
No no I m generally asking
1st May 2020, 6:22 AM
Praneet Negi
Praneet Negi - avatar
0
Ok I understand
1st May 2020, 8:15 AM
Praneet Negi
Praneet Negi - avatar
0
Tibor Santa "dictionnaries" is a good clue that the targeted language is Python, even if the best practice must be to ALWAYS tag question with the relevant targeted language ;)
1st May 2020, 12:16 PM
visph
visph - avatar