Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Lucky Dollar Store Coding Challenge
- -----------------------------------
- The “Lucky Dollar Store” wants to test out a new loyalty program so that with each new purchase, a customer is automatically entered in a weekly raffle (one ticket per purchase). At the end of the week, several users can be chosen from a drawing to win giveaway prizes (depending how generous the manager feels).
- They’ve hired you to implement this raffle and generously gave you these two functions they will be calling:
- ```
- def record_customer_purchase(customer):
- # Fill this in
- def run_weekly_raffle(num_winners):
- return winning_customer
- ```
- Here are the specifics that they’re asking for:
- - A customer can be entered in the same raffle several times
- - Create a method so that a store manager can create a raffle ticket when a customer makes a purchase
- - Create a method so that a store manager can draw X number of winners from the raffle pool (The same user cannot win multiple times in the same drawing)
- - After someone wins, they cannot win again for the next 3 raffle drawings.
- - Raffle tickets are reset between each drawing.
- *No need to set up a database or store this information anywhere. This is an acceptable flow when the program runs.
- ```
- First Raffle Drawing
- - Added new raffle ticket for "Eric"
- - Added new raffle ticket for "Eric"
- - Added new raffle ticket for "Chris"
- - Added new raffle ticket for "Dan"
- - Added new raffle ticket for "Jameson"
- - Picking the weekly winner….Jameson! (Pick 1)
- Second Raffle Drawing
- - Added new raffle ticket for "Eric"
- - Added new raffle ticket for "Eric"
- - Added new raffle ticket for "Eric"
- - Picking the weekly winner….Eric! (Pick 1)
- Third Raffle Drawing (Eric and Jameson cannot win)
- - Added new raffle ticket for "Eric"
- - Added new raffle ticket for "Jameson"
- - Picking the weekly winner…No one :( (Pick 1)
- Fourth Raffle Drawing (Eric + Jameson cannot win)
- - Added new raffle ticket for "Eric"
- - Added new raffle ticket for "Jameson"
- - Added new raffle ticket for "Chris"
- - Picking the weekly winner…Chris (pick 2)
- Fifth Raffle Drawing (Eric + Chris cannot win)
- - Added new raffle ticket for "Eric"
- - Added new raffle ticket for "Jameson"
- - Added new raffle ticket for "Chris"
- - Picking the weekly winner…Jameson (pick 1)
- ```
- Think about what classes you’d create, what data structures you’ll use, and how you’ll organize this program.
- You may use any language that you prefer. Please submit your code as a pull request in a repo you've set up on GitHub. This will help us review and comment on your code.
- Please try to limit this to 1-2 hours max. We can talk about further improvements later on.
- If you have any questions, please feel free to ask!
- Thanks,
- Eric
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement