generate a password of 8 characters that contains at least one uppercase letter, one lowercase letter, and one number in python
main.py
import random
import string
defgenerate_password(): password = []
# Generate at least one uppercase letter password.append(random.choice(string.ascii_uppercase))
# Generate at least one lowercase letter password.append(random.choice(string.ascii_lowercase))
# Generate at least one number password.append(random.choice(string.digits))
# Generate remaining charactersfor _ inrange(5):
password.append(random.choice(string.ascii_letters + string.digits))
# Shuffle the characters random.shuffle(password)
# Convert the list to a string and returnreturn''.join(password)
# Example usageprint(generate_password()) # Output: vP5oM3Fq