forked from codehouseindia/Python-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassword_generator.py
More file actions
20 lines (16 loc) · 872 Bytes
/
Password_generator.py
File metadata and controls
20 lines (16 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# https://www.facebook.com/harsith.gayle.1/posts/2784315391846205
# Subscribed by Code House
import random #importing random module
wordlist=[] #creating a list to store data
special_char =["!","@","$","#","^","-","*","&"]
with open("words.txt", 'r') as file: #opening text file
opens = file.readlines() #read the lines in file
for lines in opens:
line = lines.split() #splitting the lines
for word in line:
if len(word) >5: #selecting the words in the file
wordlist.append(word.capitalize()) #adding the words to the list
first = random.choice(wordlist) #this helps to pick a word randomly
second = str(random.randrange(10,99)) #this helps to pick a random number
third = random.choice(special_char) #this helps to pick a random character
print(first+second+third) #displaying the password