Random Password Generator
Random Password Generator
password
Generator
TEAM MEMBERS
22EG107A51 – P.Manikanta Rishi.
22EG107A04 – B.Rishitha.
22EG107A54 – P.Satya Narayana.
22EG107A07 – B.Bhoomika.
22EG107A06 – B.Vivek.
RANDOM MODULE
The “random” module is a built-in Python module that provides functionalities for
working with random numbers and random data. It is commonly used for tasks like
generating random numbers
The “choice()” method found in the random module, is used for picking a random
element from a sequence
Advantages of choice() method
1.Random Selection.
2.Uniform Distribution.
Example for random.choice()
import random
my_list = [1, 2, 3, 4, 5]
random_element = random.choice(my_list)
print(random_element)#3 (or) 4 (or) 2 (or)……..
String module
The string module in Python is a part of the standard library and provides a collection of string
constants and functions that are useful for working with strings
1.string.ascii_letters
2.string.punctuations
3.string.digits
1. string.ascii_letters
This constant is a string containing all the uppercase and lowercase letters of the English alphabet.
Specifically, it includes the letters from 'a' to 'z' and 'A' to ‘Z’
Ex->
import string
letters = string.ascii_letters
print(letters)
Output:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
2. string.punctuation
This constant is a string containing all the common punctuation characters. It includes characters like
commas, periods, exclamation marks, question marks, colons, semicolons, and various other symbols
used for punctuation.
Ex->
import string
punctuation_chars = string.punctuation
print(punctuation_chars)
Output:
!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~
3. string.digits
This constant is a string containing all the Arabic numerals from '0' to ‘9’
Ex->
import string
numeric_chars = string.digits
print(numeric_chars)
Output:
0123456789
“Random password generator”
import random , string
return password
print(password)
Output:
Enter the length of the password to be : 12
.cc4CK?>>&{<
Thank you