0

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

Edited by Ossy009

2
Contributors
3
Replies
11
Views
1 Year
Discussion Span
Last Post by Ossy009
0

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

Edited by Ossy009

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.