Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python coding help. I'm taking a beginner's programming class and need help coding this assignment. I pretty much figured I have to import random and

Python coding help.

I'm taking a beginner's programming class and need help coding this assignment. I pretty much figured I have to import random and have the range set from 0-9, but I'm lost on the rest of the assignment.

Here is the assignment:

image text in transcribed

image text in transcribed

If possible, please comment in a brief explanation within the code for each function, I would greatly appreciate it. I would like to learn how the code works and not just copy it down and turn it in.

Write a program pick3.py that simulates the simplified version of lottery game of Pick 3 and generates both a winning combination and a player's random combination. The program shows the generated combinations and determines the winning amount. In the game of Pick 3, three numbers are drawn from the range 0-9 inclusive, with repetition. Players win by matching numbers in one of the following ways (a player must specify which option they are going for) Type Winning numbers Player's numbers Prize $ 500 $ 160 Exact order Any order (2 like numbers Any order (3 different numbers Sum it up 516 665 516 516 516 665, 566, 656 516, 615, 651, 561, 165, 156 Any combination where 12 Check the table would be the sum of the digits (51 6 below Sum of 3 0 or 27 1 or 26 2 or 8 or 9 or 10, 12, 1918 11, 13, 16,14, 17 15 $500 $168$84$50$34 $24 $18 $14 $12 $10 $8$6 or 4 or or b or or 21 Prize Below are the functions you must code; your program is to perform the function operations exactly as described menu -takes no arguments, displays the menu and returns the menu choice has two-takes a player's list as an argument and returns True if at least two numbers in that list are the same; False otherwise (used to determine if a user made a valid choice) pick_three-takes no arguments and returns one element- a list of 3 random numbers from 0 to 9 inclusive; this function is equivalent to generating either a computer or a player's combination determine_prize -takes two lists, representing the player's and computer's lists, and a user choice; returns a prize value (which may be a zero) check table -takes the sum of numbers and returns the associated prize * * main - starts the game, determines validity of the user's choice Write pre- and postconditions for each function. Here are a few sample runs of the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

Question What are the advantages of a written bonus plan?

Answered: 1 week ago