Input:
Output: import random
import string
def generateRandomString(length):
chars = string.ascii_letters + string.digits
randStr = “”.join(random.choice(chars) for i in range(length))
return randStr
print(generateRandomString(8))
Prompt: Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
In Python, create a method to generate a random string.
### Input:
### Output:
import random
import string
def generateRandomString(length):
chars = string.ascii_letters + string.digits
randStr = “”.join(random.choice(chars) for i in range(length))
return randStr
print(generateRandomString(8))