0
I want to use some function in python
That function must return me any random string from a given array or list ..... How and which function could be used to solve this problem !!!!
6 Answers
+ 3
use randint from random module
+ 3
# you can use random module
import random
chars = 'abcdefghijklmnopqrstuvwxyz'
use: random.choice(chars).
If you need to get more than one character, you have to run this expression in a loop or in a comprehension.
or
use: random.choices(chars, k = n), where n is the number of desired characters. This does not need to run in a loop.
+ 1
šš¢š¢ššØ šš”šš²šš„ didn't notice that ,I should have checked first ,thks
0
Thanks šššš