password generator using random module (no function)
import random digits = list(range(10)) lower_alpha = list(map(chr, range(97, 123))) upper_alpha = list(map(chr, range(65, 91))) all_chars = digits + lower_alpha + upper_alpha def password_generator(length): pw = random.choices(all_chars, k=length) return "".join(pw) password_generator(10)