67% found this document useful (3 votes)
5K views6 pages

Random Password Generator

This document discusses generating random passwords in Python. It explains that Python is an easy to learn, powerful programming language well-suited for scripting and rapid application development. It then provides examples of using the random and string modules to generate random strings of a fixed length by choosing random characters from string constants and joining them.

Uploaded by

Arun Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
5K views6 pages

Random Password Generator

This document discusses generating random passwords in Python. It explains that Python is an easy to learn, powerful programming language well-suited for scripting and rapid application development. It then provides examples of using the random and string modules to generate random strings of a fixed length by choosing random characters from string constants and joining them.

Uploaded by

Arun Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like