Input: Not applicable
Output: import random
def generate_password(length):
password = “”
for i in range(length):
x = random.randint(1,3)
if x == 1:
password += chr(random.randint(48,57))
elif x == 2:
password += chr(random.randint(65,90))
else:
password += chr(random.randint(97,122))
return password
Prompt: Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
Create a Python program that will generate random passwords consisting of any combination of uppercase, lowercase letters, and numbers.
### Input:
Not applicable
### Output:
import random
def generate_password(length):
password = “”
for i in range(length):
x = random.randint(1,3)
if x == 1:
password += chr(random.randint(48,57))
elif x == 2:
password += chr(random.randint(65,90))
else:
password += chr(random.randint(97,122))
return password