Python Question
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →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.
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds