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
27 changes: 25 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
# Resolve the problem!!
import string

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

UPPERS = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',]
LOWERS = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',]
NUMBERS = ['1','2','3','4','5','6','7','8','9','0']

def generate_password():
# Start coding here
characters = SYMBOLS + UPPERS + LOWERS + NUMBERS #This unifies all the characters availables in one variable
password = []
# This secures at least one character from the above lists (The problem is that there is a patron!)
at_least_one_SYMBOL = random.choice(SYMBOLS)
password.append(at_least_one_SYMBOL)
at_least_one_UPPER = random.choice(UPPERS)
password.append(at_least_one_UPPER)
at_least_one_LOWER = random.choice(LOWERS)
password.append(at_least_one_LOWER)
at_least_one_NUMBER = random.choice(NUMBERS)
password.append(at_least_one_NUMBER)

for char in range(11):
characters_random = random.choice(characters)# This makes a random choice from the characters
password.append(characters_random) # Add it to the empty list

print(password) # This is the pre-password
random.shuffle(password) # Here change the places of the characters to fix the problem from above
password = "".join(password) #This makes the entire list one string, eliminating the commas, apostrophe and brackets.
print(password)

return password

def validate(password):

Expand Down