Python control structure exampe program

Completed Posted Oct 25, 2015 Paid on delivery
Completed Paid on delivery

Comparing Times

Write a function called time_compare that will have 4 parameters. These four integers represent 2 times, that is hour and minute of the first time, then the hour and minute of the second time. It returns an integer, which will be 0, 1 or 2. 0 means the two times were the same. 1 means that the first time came before the second one. 2 means the first time came after the second one.

Example calls:

compare(1,2,3,4) would return 1 because 1:02 comes before 3:04.

compare (12, 19, 12, 1) would return 2 because 12:19 comes after 12:01.

compare (3, 4, 3, 4) would return 0 because they are the same time.

Each function that returns a value uses ONE return statement at the bottom of the function definition. Use a variable to hold the return value until execution is done in the function, then return that variable.

The compare function does NOT do any input from the keyboard or output to the screen. Its interaction with the rest of the program is through its parameters and its return value.

compare the two hours first. If they are different, you have your answer without having to look at the minutes at all.

You do NOT want to write a main function for this program. Instead, open your file in your IDE. in the shell, type in a call to the function, like "time_compare(12,15,15,3)". This means you want to compare times 12:15 and 15:03. The result should be a 1.

Develop 4 test cases for this program. Example: "first time comes after second time, hour1 after hour2", 13, 20, 8, 15 (as inputs), expected return value is 2. List them in the program file as comments at the bottom of the file

Small project looking to spend around $10

Python Software Architecture

Project ID: #8764275

About the project

10 proposals Remote project Active Oct 25, 2015

Awarded to:

fejs

Hi Sir/Madam, I'm expert in Python programming and I can help You with this task in no time. Best regards, Fejs.

$10 USD in 1 day
(142 Reviews)
6.3

10 freelancers are bidding on average $15 for this job

urmate

HI Contact me for an efficient, perfect, well documented development of your project according to 100% accuracy and requirements, with dedicated support. Thanks

$25 USD in 1 day
(359 Reviews)
7.0
devgeek0

Hello An easy thing. Not really much to say. I can have this done for you in a couple minutes. Let me know if you are interested. Kind Regards Martin

$12 USD in 1 day
(6 Reviews)
2.9
SharjeelSohail

A proposal has not yet been provided

$10 USD in 1 day
(2 Reviews)
1.5
cppgohan

What about error params like 12:99 25:01 ? what to return?

$15 USD in 1 day
(0 Reviews)
0.0
csiegman

Hello! I've been using python for a number of years, and I can handle this project for you right away. Thanks for your consideration! -Chris

$25 USD in 1 day
(0 Reviews)
0.0
davidmsteiner

A proposal has not yet been provided

$10 USD in 1 day
(0 Reviews)
0.0
lunkw1ll

hello, if you don't need any error checking then IT IS DONE. give me your email and I will send the file right now

$10 USD in 0 days
(0 Reviews)
0.0
alexanjs

I am willing to do it quickly and have it to you as soon as possible. I can do it cheaply as well. Email me if you would like me to do this for you. Thanks.

$20 USD in 1 day
(0 Reviews)
0.0