Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. Lucky Dollar Store Coding Challenge
  2. -----------------------------------
  3.  
  4. 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).
  5.  
  6. They’ve hired you to implement this raffle and generously gave you these two functions they will be calling:
  7.  
  8. ```
  9. def record_customer_purchase(customer):
  10. # Fill this in
  11.  
  12.  
  13. def run_weekly_raffle(num_winners):
  14. return winning_customer
  15. ```
  16.  
  17. Here are the specifics that they’re asking for:
  18.  
  19. - A customer can be entered in the same raffle several times
  20. - Create a method so that a store manager can create a raffle ticket when a customer makes a purchase
  21. - 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)
  22. - After someone wins, they cannot win again for the next 3 raffle drawings.
  23. - Raffle tickets are reset between each drawing.
  24.  
  25. *No need to set up a database or store this information anywhere. This is an acceptable flow when the program runs.
  26.  
  27. ```
  28. First Raffle Drawing
  29. - Added new raffle ticket for "Eric"
  30. - Added new raffle ticket for "Eric"
  31. - Added new raffle ticket for "Chris"
  32. - Added new raffle ticket for "Dan"
  33. - Added new raffle ticket for "Jameson"
  34. - Picking the weekly winner….Jameson! (Pick 1)
  35.  
  36. Second Raffle Drawing
  37. - Added new raffle ticket for "Eric"
  38. - Added new raffle ticket for "Eric"
  39. - Added new raffle ticket for "Eric"
  40. - Picking the weekly winner….Eric! (Pick 1)
  41.  
  42. Third Raffle Drawing (Eric and Jameson cannot win)
  43. - Added new raffle ticket for "Eric"
  44. - Added new raffle ticket for "Jameson"
  45. - Picking the weekly winner…No one :( (Pick 1)
  46.  
  47. Fourth Raffle Drawing (Eric + Jameson cannot win)
  48. - Added new raffle ticket for "Eric"
  49. - Added new raffle ticket for "Jameson"
  50. - Added new raffle ticket for "Chris"
  51. - Picking the weekly winner…Chris (pick 2)
  52.  
  53. Fifth Raffle Drawing (Eric + Chris cannot win)
  54. - Added new raffle ticket for "Eric"
  55. - Added new raffle ticket for "Jameson"
  56. - Added new raffle ticket for "Chris"
  57. - Picking the weekly winner…Jameson (pick 1)
  58. ```
  59.  
  60. Think about what classes you’d create, what data structures you’ll use, and how you’ll organize this program.
  61.  
  62. 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.
  63.  
  64. Please try to limit this to 1-2 hours max. We can talk about further improvements later on.
  65.  
  66. If you have any questions, please feel free to ask!
  67.  
  68. Thanks,
  69. Eric
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement