Anda di halaman 1dari 6

Random

Password
Generator
USING PYTHON
• Python is an easy to learn, powerful programming language.
• It has efficient high-level data structures and a simple but effective
approach to object-oriented programming.
• Python's elegant syntax and dynamic typing, together with its
interpreted nature, make it an ideal language for scripting and rapid
application development in many areas on most platforms.

• FEATURES OF PYTHON
• Simple

About PYTHON •

Easy to Learn
Free and Open Source
• High-level Language
• Portable
• Object Oriented
• Interpreted
• Generate a random string of a fixed
length.
• Generate a random string with lower case
and upper case.
• Generate a random alphanumeric
string with letter and numbers.
TYPES • Generate random string which contains
the letters, digits, and special characters.
• Generate a random password.
• Use the UUID module and secrets module
to generate a secure random string for
the sensitive application.
Generate a random string of fixed length

• String module which contains various string constant which contains the ASCII characters of all cases.
String module contains separate constants for lowercase, uppercase letters, digits, and special characters.
• random module to perform the random generations.
• Use the string constant string.ascii_lowercase to get all the lowercase letter in a single string.
• The string.ascii_lowercase constant contains all lowercase letters. I.e. 'abcdefghijklmnopqrstuvwxyz'
• Run for loop n number of times to pick a single character from a string constant using a random.choice
method and add it to the string variable using a join method. The choice method used to choose the
single character from a list.
• Suppose you want a random string of length 6 then we
can execute a random.choice() method 6 times to pick
a single letter from the string.ascii_lowercase and add It
to the string variable.

• import random
• import string
• def randomString(stringLength=10):
EXAMPLE • """Generate a random string of fixed length """
• letters = string.ascii_lowercase
• return ''.join(random.choice(letters) for i in
range(stringLength))
• print ("Random String is ", randomString() )
• print ("Random String is ", randomString(10) )
• print ("Random String is ", randomString(10) )
OUTPUT
Random String is ptmihemlzj
Random String is dbgxpggrez
Random String is wkhhaghero

Anda mungkin juga menyukai