[Solved] How do I print different random numbers in for loop?


You generate the CC number once and display it multiple times. Instead, put the CC generator in the loop.

from random import choices
from string import digits

for _ in range(5):
    cc_digits = choices(digits, k=16)
    cc_number = "".join(cc_digits)
    space = " ".join(cc_number[i:i+4] for i in range(0, len(cc_number), 4))
    print(space)

1

solved How do I print different random numbers in for loop?