Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task # 1 ( 1 point ) Import the random library. Task # 2 ( 5 points ) Define named constant and global variables as
Task # point Import the random library. Task # points Define named constant and global variables as indicated above. Task # points Define a function name it rolldice that will generate two random integers between and inclusive and return their sum. Task # points Define a function name it wins that will accept one integer argument name it player The function will return True if anyone of the players wins, otherwise, it will return False. For a player to win, the bank must be greater than or equal to MAXIMUMBANK. Task # points Define a function name it updatebank The function will accept two integers player and value The function will add value to the bank of that player. Task # points Define a function name it welcomemessage that will return the string. "Welcome to the game of DICE" "Enjoy!" Task # points Define a function reset that will set the banks to zero Task # points Define a function name it playdice that will play a single round of the DICE game. Use a random generator to determine the player or to play first name it firstplayer The second player will be firstplayer. The players will take turns to play note that this is being simulated and the computer plays both players by using random generated numbers. Use a while loop for the round; the end of a round is reached when a player wins. Task # points Using if namemain statement, prompt user to enter the number of rounds to play n display the welcome message, use a for loop to play rounds and in each round, call reset function and the playdice function. Display the number of wins for each player.
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