Q:

Generate random String of length 5 using python programming

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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now