From 8a2e1006b3b272126332aa064f3ad95387129544 Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan <biswa@surgot.in> Date: Thu, 13 Feb 2025 14:13:49 +0530 Subject: new dot files --- .local/bin/randompass | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 .local/bin/randompass (limited to '.local/bin/randompass') diff --git a/.local/bin/randompass b/.local/bin/randompass new file mode 100755 index 0000000..fca095d --- /dev/null +++ b/.local/bin/randompass @@ -0,0 +1,31 @@ +#! /usr/bin/python +import string +import random + + +## characters to generate password from +characters = list(string.ascii_letters + string.digits + "!@#$%^&*()") + +def generate_random_password(): + ## length of password from the user + length = int(input("Enter password length: ")) + + ## shuffling the characters + random.shuffle(characters) + + ## picking random characters from the list + password = [] + for i in range(length): + password.append(random.choice(characters)) + + ## shuffling the resultant password + random.shuffle(password) + + ## converting the list to string + ## printing the list + print("".join(password)) + + + +## invoking the function +generate_random_password() -- cgit v1.2.3-59-g8ed1b