You are on page 1of 1

Import random

Import string

Def generate_captcha():

# generate a 4-digit number

Digits = random.randint(1000, 9999)

# generate 2 random alphabet

Alphabets = random.sample(string.ascii_letters, 2)

# combine digits and alphabets

Captcha = str(digits) + ‘’.join(alphabets)

Return captcha

Print(generate_captcha())

You might also like