Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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 games

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

why do consumers often fail to seek out higher yields on deposits ?

Answered: 1 week ago

Question

2. Provide recommendations for effective on-the-job training.

Answered: 1 week ago