Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Update python-password-generator.py #552

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions projects/Random_password_generator/python-password-generator.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
#import the necessary modules
import random
import string

total = string.ascii_letters + string.digits + string.punctuation
print('hello,Welcome to Password generator!')

length = 16
#input the length of password
length=int(input('\Enter the length of password: '))

password = "".join(random.sample(total, length))
#define data
lower=string.ascii_lowercase
upper=string.ascii_uppercase
num=string.digits
symbols=string.punctuation

#combine the data
all=lower+upper+num+symbols

#use random
temp=random.sample(all,length)

#create the password
password="".join(temp)

#print the password
print(password)