Question
need in python: You must create functions in this program. You will be required to implement and use the following functions as given, with the
need in python:
You must create functions in this program. You will be required to implement and use the following functions as given, with the arguments given.choose_number() - This function returns an integer from 1 to 5 inclusive (1, 5). It will continually ask the user for a number. We dont expect the user to give anything other than an integer, but this function should continually ask for input until they finally provide a valid integer. If they do not enter valid input it will continually ask them until they do.
Choose_even_or_odd() - This function takes no arguments and returns a boolean ( True or false). It returns True if the user chooses even, and False if they do not. is_match(even : boolean, user1_number : int, user2_number : int) - This function has 3 arguments and returns a boolean. Even indicates if the player chooses the result to be even or odd. Its True if they choose even, False if they had chosen odd. The function returns true if the result matches their prediction. If the numbers add up to an even number and the even is True, then the function returns true. choose_number_of_rounds() - This function takes no arguments and returns an integer. It will continually ask the user for an integer input from 3 - 15, inclusive. ( 3, 15). Very much like the function above. ( Since these functions are so similar, you may want to think of a way to make one function that does the work of both. What would you pass to this function? ) Youll want to implement more functions and will be graded on those that you provide. you must provide at LEAST 2 more functions.
sample program:
How many rounds would you like to play? (3-15) ==> 2 You must choose a number from 3-15 inclusive. How many rounds would you like to play? (3-15) ==> 16 You must choose a number from 3-15 inclusive. How many rounds would you like to play? (3-15) ==> 4 Round 1 of 4. Score o to o Enter a number from 1 to 5 ( inclusive ) ==> 0 You must choose a value between 1 and 5 only Enter a number from 1 to 5 ( inclusive ) ==> 6 You must choose a value between 1 and 5 only Enter a number from 1 to 5 ( inclusive ) ==> 4 Enter E for even or o for odd ==> i You must enter E or o only. No other characters. Enter E for even or o for odd ==> 5 You must enter E or o only. No other characters. Enter E for even or o for odd ==> O The computer chose 4. 4+4 is even. You lost Round 2 of 4. Score 0 to 1 Enter a number from 1 to 5 ( inclusive ) ==> 3 Computer chose even The computer chose 1. 1+3 is even. You lost Round 3 of 4. Score 0 to 2 Enter a number from 1 to 5 ( inclusive ) ==> 4 Enter E for even or o for odd ==> e The computer chose 2. 2+4 is even. You won Round 4 of 4. Score 1 to 2 Enter a number from 1 to 5 ( inclusive ) ==> 2 Computer chose odd The computer chose 5. 5+2 is odd. You lost Sorry you lost. You only won 1 of 4 or 25.00% of the games How many rounds would you like to play? (3-15) ==> 2 You must choose a number from 3-15 inclusive. How many rounds would you like to play? (3-15) ==> 16 You must choose a number from 3-15 inclusive. How many rounds would you like to play? (3-15) ==> 4 Round 1 of 4. Score o to o Enter a number from 1 to 5 ( inclusive ) ==> 0 You must choose a value between 1 and 5 only Enter a number from 1 to 5 ( inclusive ) ==> 6 You must choose a value between 1 and 5 only Enter a number from 1 to 5 ( inclusive ) ==> 4 Enter E for even or o for odd ==> i You must enter E or o only. No other characters. Enter E for even or o for odd ==> 5 You must enter E or o only. No other characters. Enter E for even or o for odd ==> O The computer chose 4. 4+4 is even. You lost Round 2 of 4. Score 0 to 1 Enter a number from 1 to 5 ( inclusive ) ==> 3 Computer chose even The computer chose 1. 1+3 is even. You lost Round 3 of 4. Score 0 to 2 Enter a number from 1 to 5 ( inclusive ) ==> 4 Enter E for even or o for odd ==> e The computer chose 2. 2+4 is even. You won Round 4 of 4. Score 1 to 2 Enter a number from 1 to 5 ( inclusive ) ==> 2 Computer chose odd The computer chose 5. 5+2 is odd. You lost Sorry you lost. You only won 1 of 4 or 25.00% of the 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