Question

IN PYTHON ASAP. Write a program that asks a user to enter two times, that hour...

IN PYTHON ASAP. Write a program that asks a user to enter two times, that hour and min. Then the program must determine which of the two times come first and produces formatted output on to the console. See the example run of the sample program.

Enter the hour for the first time: 12 Enter the minute for the first time: 32 Enter the hour for the second time: 1 Enter the minute for the second time: 12

The first time is 01:12 The second time is 12:32

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code:

hour_first=int(input("Enter hour for the first time:"))

minute_first=int(input("Enter the minute for the first time:"))

hour_second=int(input("Enter hour for the second time:"))

minute_second=int(input("Enter the minute for the second time:"))

if(hour_first<hour_second):

print("The first time is {}:{} The Second Time is {}:{}".format(hour_first,minute_first,hour_second,minute_second))

elif(hour_first==hour_second):

if(minute_first<minute_second):

print("The first time is {}:{} The Second Time is {}:{}".format(hour_first,minute_first,hour_second,minute_second))

elif(minute_second<minute_first):

print("The first time is {}:{} The Second Time is {}:{}".format(hour_second,minute_second,hour_first,minute_first))

elif(hour_second<hour_first):

print("The first time is {}:{} The Second Time is {}:{}".format(hour_second,minute_second,hour_first,minute_first))



#output:

#if you have any doubt comment below..

Add a comment
Know the answer?
Add Answer to:
IN PYTHON ASAP. Write a program that asks a user to enter two times, that hour...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT