Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Python program as described below and save it in a file named bool. You should use IDLE or similar environment to create your

Create a Python program as described below and save it in a file named bool. You should use IDLE or similar environment to create your program. First develop a conceptual model and document it using either pseudo code or a flowchart to meet the requirements of the program described as follows.

Write a compare function that returns 1 if a > b , 0 if a == b , and -1 if a < b. The user must be prompted for the values of a and b. The compare function must have arguments for a and b. To demonstrate your compare function, you must call the compare function three times, once for each condition, from within your program and display (using print statement) the return code of the function. Of course you will make static calls to your function to meet the test requirements. Something like: print compare(5,2) print compare(2,5) print compare(3,3) Then your program will switch to user input.

Something like: print compare(user_input_A, user_input_B) Use the following table of values for a and b can be used when calling to test your compare function from within your program:

Dont forget to use comments and make your program readable.

Test values

a b

5 2

2 5

3 3

PLEASE EXPLAIN each aspect of the code - say WHY you use "python __main__" EXPLAIN the purpose and the logic behind using it- If you use "%" explain WHY this is being used- please- break each aspect down into an explanation

Thank you

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago