random password generator python

from random import randint

def create_random_chars(nbr_of_chars):
    return "".join(chr(randint(33,126)) for i in range(nbr_of_chars))


print(create_random_chars(10))
# I1CU>E5q;$

Here is what the above code is Doing:
1. We create a list of random integers using the randint function from the random module.
2. We use the chr function to convert the integers to characters.
3. We use the join function to join the characters into a string.
4. We return the string.