summaryrefslogtreecommitdiffstats
path: root/randompass
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-09-24 12:21:56 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-09-24 12:21:56 +0530
commit86f99da8d08e1f2e290d8ebfd5adb016faff7bac (patch)
tree8f121a2aaa187d8266e20df23ad36262ab051866 /randompass
downloadbin-86f99da8d08e1f2e290d8ebfd5adb016faff7bac.tar.gz
bin-86f99da8d08e1f2e290d8ebfd5adb016faff7bac.tar.bz2
bin-86f99da8d08e1f2e290d8ebfd5adb016faff7bac.zip
script's
Diffstat (limited to 'randompass')
-rwxr-xr-xrandompass31
1 files changed, 31 insertions, 0 deletions
diff --git a/randompass b/randompass
new file mode 100755
index 0000000..fca095d
--- /dev/null
+++ b/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()