To create random passwords we used import random
. The function definition was simply:
def generate_password(): return random.choice(word_list) + random.choice(word_list) + random.choice(word_list)
Alternatively, you could use the random.sample
function and .join
method for strings:
def generate_password(): return ''.join(random.sample(word_list,3))
댓글을 달려면 로그인해야 합니다.