Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions password_generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Password Generator

A simple Python program that generates a random password based on user-defined length.

## Features
- Generates strong passwords
- Includes letters, numbers, and symbols
- Input validation included
20 changes: 20 additions & 0 deletions password_generator/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import random

characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-_+="

try:
length = int(input("Enter password length: "))

if length <= 0:
print("Please enter a positive number.")
else:
password = ""

for i in range(length):
char = random.choice(characters)
password += char

print("Generated Password:", password)

except ValueError:
print("Invalid input! Please enter a number.")