From bac71962ae0895dbc4be07f4eba26cb34328fd95 Mon Sep 17 00:00:00 2001 From: Suraj Kulkarni Date: Thu, 17 Oct 2024 15:43:58 +0530 Subject: [PATCH] Create Password_generator.py This Password Generator helps us to generate complex Password which are not easy to view and copypaste in any other source which makes it even more secure to use and trustful. Thank you --- Python/Password Generator/Password_generator.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Python/Password Generator/Password_generator.py diff --git a/Python/Password Generator/Password_generator.py b/Python/Password Generator/Password_generator.py new file mode 100644 index 000000000..f49226b64 --- /dev/null +++ b/Python/Password Generator/Password_generator.py @@ -0,0 +1,17 @@ +import random +import string + +def generate_password(length=8): + uppercase_letters = string.ascii_uppercase + lowercase_letters = string.ascii_lowercase + digits = string.digits + special_characters = string.punctuation + + all_characters = uppercase_letters + lowercase_letters + digits + special_characters + password = ''.join(random.choice(all_characters) for _ in range(length)) + + return password + +length = int(input("Enter the password length: ")) +generated_password = generate_password(length) +print(f"Generated password: {generated_password}")