Python Question
Required
1. In this assignment, you are going to write codes to select winners for prizes.
2. Setting: There is a Python coding competition. To encourage participation, the organizers have decided to hold a special event in which 4 participants out of 20 will receive prizes. The first winner will receive an iPad and the next three will receive Starbucks gift card.
3. You are to write codes to draw 4 winners out of 20.
4. The rules are as follows:
Rule 1: Write codes to create 20 participants in the competition denoted by numbers.
Rule 2: Write codes to draw 4 participants randomly. Refer to the following codes for suggestions.
Rule 3: Write codes to select one winner for an iPad and three winners for a Starbucks gift card. Note that one person cannot win prizes twice.
- Suggestion: Out of the four participants selected, the first one in the list receives an iPad, and the other three receive a Starbucks gift card.
- Rule 4: Write codes to generate an output statement with prize winners. For example,
- “iPad winner: 1”
“Starbucks gift card winners: [2, 3, 4]”
- “Congratulations!”
3. Once you write codes, copy and paste them onto MS word doc.
Suggestions
- 1. Use syntax “list”, “range”, “shuffle”, “sample”
- 2. One important rule is that one participant “cannot” win twice. To satisfy the rule, first randomly select four winners. Then, pick the first in line as the ipad winner and the remaining three win the gift cards.
3. Refer to the lecture materials to write codes.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.
