Skip to content
Open
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
24 changes: 24 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
# Resolve the problem!!
import string
import random


SYMBOLS = list('!"#$%&\'()*+,-./:;?@[]^_`{|}~')
LETTERS = list('abcdefghijklmnopqrstuvwxyz')
CAPITAL_LETTERS = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
NUMBERS = list('0123456789')


def generate_password():
# Start coding here
characters = SYMBOLS + LETTERS + CAPITAL_LETTERS + NUMBERS
password = []

one_SYMBOL = random.choice(SYMBOLS)
one_LETTER = random.choice(LETTERS)
one_CAPITAL_LETTER = random.choice(CAPITAL_LETTERS)
one_NUMBER = random.choice(NUMBERS)

password.extend([one_SYMBOL, one_LETTER , one_CAPITAL_LETTER, one_NUMBER])
random_password_length = random.randint(4, 12)

for i in range(random_password_length):
random_character = random.choice(characters)
password.append(random_character)

random.shuffle(password)
password = ''.join(password)

return password


def validate(password):
Expand Down