From f7489246b6364bf500ccaa2e057b288d90560ba4 Mon Sep 17 00:00:00 2001 From: Rohith Date: Wed, 4 Feb 2026 20:26:42 +0530 Subject: [PATCH 1/2] Add password generator functionality in mainpass.py --- Password-Generator/mainpass.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Password-Generator/mainpass.py diff --git a/Password-Generator/mainpass.py b/Password-Generator/mainpass.py new file mode 100644 index 0000000..bed85e8 --- /dev/null +++ b/Password-Generator/mainpass.py @@ -0,0 +1,17 @@ +import random +import string + +def generate_password(length): + """Generate a random strong password.""" + characters = string.ascii_letters + string.digits + string.punctuation + return ''.join(random.choice(characters) for _ in range(length)) + +if __name__ == "__main__": + try: + length = int(input("Enter password length: ")) + if length <= 0: + print("Password length must be greater than 0.") + else: + print("Generated Password:", generate_password(length)) + except ValueError: + print("Please enter a valid number.") From f124908e9e95f1adc42990fc470f4825e775690b Mon Sep 17 00:00:00 2001 From: Rohith Date: Wed, 4 Feb 2026 20:27:59 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c7c32c9..9bac786 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # Python-Projects Beginner Level Python Projects, good first issue + +Improve password generator with validation and function