Question
Python question Task 3 Create a function named poker_jackpot that runs a poker game consisting of one or more rounds. The function uses two parameters:
Python question
Task 3
Create a function named poker_jackpot that runs a poker game consisting of one or more rounds. The function uses two parameters: the first parameter, num_players, indicates the number of players in the game, and the second parameter, avg_bet, indicates the average bet amount per round. The number of rounds in the game depends on the number of players playing: after each round completes, one player is eliminated until only one player is left, at which point the game is over. During each round (a round has at least two players), each player remaining in the round makes an average bet, which is added to the jackpot.
So for example, in a game that starts with four players, round 1 would have four players and four bets, round 2 would have three players and three bets, and round 3 would have two players and two bets. Then the game ends. Each of the bets from all three rounds is added to the jackpot.
The jackpot is $0 at the start of the game. When the game ends, your function should print the value of the number of rounds that were played and the final value of the jackpot. It should also return the value of the jackpot.
Notes:
The function should print the number of rounds that were played and the final jackpot amount. For example, for a game consisting of 4 players and an average bet of $100, the function should print:
Total Jackpot after 3 rounds: $900
Don't forget to include the dollar sign and spaces where needed.
Make sure that the function returns a value, not just prints a result.
Hint #1: You might want to use a for-loop with a decreasing counter to track the rounds.
Hint #2: Try using an accumulator pattern to total all the bets.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started