mardi 4 mai 2021

How to Generate random code with 4 digit string and 4 digit number in Python?

I have this code

import random


FullChar = 'CDHKPQRVXY123456789'
total = 10
count = 8

for i in range(total):
    unique_code = ''.join(random.sample(FullChar, count))
    print(unique_code)

how can i generate random code with just 4 digit string and 4 digit number in Python?

Expected Output:

FH98UK67
23YTP7H4
14XG3QD2
H12P56KV



Aucun commentaire:

Enregistrer un commentaire