I'm stuck on adding a feature to my program where a user types in the email address and stores email and raffle into a database.Also the raffle entires will be selected at random from all stores entries.heres my code
from future import print_function
from random import seed, randrange, shuffle, sample
colors = [
'Blue', 'Aqua', 'Jade',
'Plum', 'Gold', 'Navy',
'Pink', 'Grey', 'Ruby',
'Rose', 'Teal', 'Lime',
]
num_colors = len(colors)
def num_to_ticket(n):
color = colors[n % num_colors]
num = str(n // num_colors).zfill(8)
return '{0} {1} {2}'.format(color, num[:4], num[4:])
seed(1234)
num_tickets = 15
num_winners = 4
tickets = set()
while len(tickets) < num_tickets:
ticket = randrange(1200000000)
tickets.add(ticket)
for n in tickets:
print(num_to_ticket(n))