Create real strong password generator with python

How to make strong password generator with PYTHON ?

Let's see 👇🏻

Step 1

→ First import build-in string module
→ store all characters ( uppercase or lower or digit or punctuation ) in their respective list
1

Step 2

→ Taking input for the numbers of characters in password and adding some conditions so that wrong input can be handle.
2

Step 3

→ import build-in random module and shuffle all 4 list
→ shuffle each list with random.shuffle(list_name)
→ we will create password with 30% of uppercase (characters number given by user) , 30% lowercase, 20% digits and 20% special character
3

Step 4

→ collecting characters from all 4 lists as the rule of 30%, 30% ,20%,20%
→ Now shuffle the final collected list for making the password pattern unguessed
→ Now join the final list elements with " ".join( )
4

FINAL code

import string
import random

s1=list(string.ascii_lowercase)
s2=list(string.ascii_uppercase)
s3=list(string.digits)
s4=list(string.punctuation)

characters_number=input("Enter the numbers of characters of your password: ")
while True:
    try:
        characters_number=int(characters_number)
        if characters_number < 6:
            print("you need at least 6 characters for a strong password !")
            characters_number=input("Enter the numbers of characters AGAIN: ")
        else:
            break
    except:
        print("X X X    please enter the number of characters ONLY !!!")
        characters_number=input("Enter the numbers of characters: ")

random.shuffle(s1)
random.shuffle(s2)
random.shuffle(s3)
random.shuffle(s4)
# 30% of the characters_number👇🏻
end1=round(characters_number * (30/100)) 
# 20% of the characters_number👇🏻
end2=round(characters_number * (20/100))    

s=[]
for i in range(end1):
    s.append(s1[i])
    s.append(s2[i])

for i in range(end2):
    s.append(s3[i])
    s.append(s4[i])

random.shuffle(s)
password="".join(s[0:])
print(f'your password is : {password}')

check the output

20