Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I really need help with the following code. I have to write out the functions and that's is, I do not need to do
Hello, I really need help with the following code. I have to write out the functions and that's is, I do not need to do anything else with it. It is written through code hs and it is done in python language. *The output will obviously not look how it is shown below exactly since right now all I have to do is actually write out the functions and not actually complete the whole code. Please someone help me. Thank you :)
numbersLeft = 17
maxCanGrab = 4
Coding Tip: To get a loop to print out a series of values on the same line, put a comma (,), after the value being printed. Please see this example: for i in range(4): print i, outputs: 0 1 2 3 Create the following functions that will be used by the main program created in part 2 to play the game. These functions might use any global variables, but not always. In other words, you do not need to know any of the code in the main program, other than what is given to you, to do this. These functions will just complete simple tasks. getPlayerChoice() No parameters. Gets the user input for the amount of numbers they want to grab in the function. Checks to make sure this number is valid. The value can not be negative or greater than the maxCanGrab or numbersLeft. . Returns the amount getCompChoice) o No parameters. Assign the computer's choice to a valid random number. . Return that amount. . Challenge: After you have this working, make this amount a smart choice so that computer is purposfully trying to win. printBoard() Takes a int as the parameter. This is the quantity of numbers left. Prints the list of numbers left. . Put a dash at the beginning and end of the number list printFinalRecord) Takes the number of player wins and computer wins as the parameters. Prints the number of games the player and computer won. Then test each function by simply calling the functions in the main part. Print any calls to functions that return a value and use values as parameters if needed. For example: print getPlayersChoice() printBoard(17) The output should look like this: How many will you grab? 4 You took 4 I took 2 - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - Final Record: You won 5 games. I won gamesStep 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