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:])


num_tickets = 15
num_winners = 4

tickets = set()
while len(tickets) < num_tickets:
ticket = randrange(1200000000)

for n in tickets:

Recommended Answers

All 3 Replies

Someone implented Code into mine all I need is a code that allows user to type in the email address and store that and the random raffle into a Db plus view raffle entries and I have the code for the random selection

More efficant to understand the code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.