Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanMittal11 authored Mar 22, 2024
1 parent 9140559 commit 8b28768
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions PasswordGenerator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import random
import string


def complex_pass(length):
char1 = string.ascii_letters + string.digits + string.ascii_uppercase + string.ascii_lowercase + string.punctuation
password = ''.join(random.choice(char1) for _ in range(length))
return password


def mod_pass(length):
char1 = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(char1) for _ in range(length))
return password


def simple_pass(length):
char1 = string.ascii_letters + string.digits
password = ''.join(random.choice(char1) for _ in range(length))
return password


def main():
while True:
length = int(input("Enter the length of password you want: "))
if length <= 0:
print("Please enter valid length")
else:
break
complexity = input("Enter the complexity of password (complex/moderate/simple): ")
if complexity == "complex":
print("Your password is : ", complex_pass(length))
elif complexity == "moderate":
print("Your password is : ", mod_pass(length))
elif complexity == "simple":
print("Your password is : ", simple_pass(length))
else:
print("Invalid Option")


if __name__ == "__main__":
main()

0 comments on commit 8b28768

Please sign in to comment.