15 lines
379 B
Python
15 lines
379 B
Python
import random
|
|
|
|
|
|
def random_key(length):
|
|
characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
return ''.join(random.choice(characters) for i in range(length))
|
|
|
|
|
|
inp = input('password length: ')
|
|
if inp != '':
|
|
inp = int(inp)
|
|
print('your random password is:\n' + random_key(inp))
|
|
else:
|
|
print('your random password is:\n' + random_key(8))
|