password to password smart password generator

PHOTO EMBED

Sun Jul 20 2025 17:25:40 GMT+0000 (Coordinated Universal Time)

Saved by @freepythoncode ##python #coding #python

import string
from random import choice

def generate_like_this(password):
    password_content = [
        string.digits,
        string.punctuation,
        string.ascii_lowercase,
        string.ascii_uppercase
    ]

    new_pass = ''

    for p_char in password:
        for p_list in password_content:
            if p_char in p_list:
                new_pass += choice(p_list)
            
    return new_pass


result = generate_like_this('abc123/*')
print(result)
content_copyCOPY