Q:

Generate random String of length 5 using python programming

belongs to collection: Random Data Generation Exercises

0

Generate random String of length 5

Note: String must be the combination of the UPPER case and lower case letters only. No numbers and a special symbol.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import random
import string

def randomString(stringLength):
    """Generate a random string of 5 charcters"""
    letters = string.ascii_letters
    return ''.join(random.choice(letters) for i in range(stringLength))

print ("Random String is ", randomString(5) )

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Generate a random Password which meets the followi... >>
<< Pick a random character from a given String using ...