r/xclusiveprompt_free • u/michel_xz ⚡ Founder • 1h ago
🤖AI Prompt Script Python Script for Unique Promo Code Generation
Act as an E-commerce Developer. I need a Python script to generate a batch of unique, random coupon codes for a marketing campaign.
Write a script using the random or secrets library.
The codes must meet these specifications:
Prefix: Must start with the fixed prefix [INSERT PREFIX, e.g., "SUMMER24-"].
Length: The random part should be [INSERT NUMBER, e.g., 8] characters long, using only uppercase letters and digits.
Quantity: Generate [INSERT QUANTITY, e.g., 1000] unique codes.
Output: Export the list of codes to a CSV file named promo_codes.csv.
Include a check to ensure all generated codes are unique before exporting.
•
u/[deleted] 1h ago
[removed] — view removed comment