1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
finlep [7]
3 years ago
9

Description

Computers and Technology
1 answer:
lapo4ka [179]3 years ago
5 0

Answer:

from datetime import time, datetime, timedelta, date

for _ in iter(list, 0):

   t1 = input("Please enter time one: ")

   t2 = input("Please enter time two: ")

   if t1.isdigit() == True and (int(t1[:2])<=23 and int(t1[2:]) <= 59)\

       and t2.isdigit() == True and (int(t2[:2])<= 23 and int(t2[2:])<=59):

       time_1 = time(hour=int(t1[:2]), minute=int(t1[2:]))

       time_2 = time(hour= int(t2[:2]), minute=int(t2[2:]))

       if time_1 > time_2:

           diff = datetime. combine (date. today( ), time_1) - datetime. combine(date. today ( ), time_2)

       else:

           diff = datetime. combine (date. today( ), time_2) -datetime. combine(date. today ( ), time_1)

       diff_list = str(diff).split(":")

       del diff_list[2]

       diff_t = "". join (diff_list)

       print(diff_t)

       break        

   if t1.isdigit() == False or t2.isdigit() == False:

       print("Military Time Forest Required: Bad input, try again.")

       continue

   elif int(t1[:2])> 23 or int(t2[:2])> 23:

       print("Military Tine Format Required: Hours must be between 00 and 23, try again")

       continue

   elif int(t1[2:])> 59 or int(t2[2:])> 59:

       print("Military Tine Format Required: Minutes must be between me and 59, try again")

       continue

Explanation:

The python Datetime package is used to manipulate date and time, creating immutable Datetime objects from the various python data types like integer and string. The block of code above is a conditional for-loop statement that gets two user time value inputs and prints out the difference as a string in Military forest time format.

You might be interested in
Write a loop to print 10 to 90 inclusive (this means it should include both the 10 and 90), 10 per line.​
Masja [62]

Answer:

c = 0

for x in range(10,91):

   print(x, end=" ")

   c = c + 1

   if c>=10:

       print(" ")

       c=0

Explanation:

8 0
3 years ago
suppose as a head software engineer you assign the job of creating a class to a subordinate. You want to specify thirty-eight di
Goryan [66]

Answer:

jskjsjsjsjskdmsnjsnsnsns

8 0
3 years ago
Assume you're using a three-button mouse. To access shortcut menus, you would
irina1246 [14]
If you are using the three-button mouse, in order to access the shortcut menus, you would right click the mouse. 
If you right click your mouse, it will show shortcut menus that can be easily accessed.
5 0
2 years ago
Why should you avoid the use of sarcasm, clichés, and idioms in business letters?
Alex

You should avoid those types of writing because it doesn't make you look like you are a professional.


hope this helps!

8 0
3 years ago
Read 2 more answers
Write a program that asks the user to input their first and last names. The first prompt should state:
VikaD [51]

first = input("Please input your first name: ")

last = input("Please input your last name: ")

print(last+", "+first)

I hope this helps!

8 0
2 years ago
Other questions:
  • Which one is not among standard creation committee?
    9·1 answer
  • An email message form includes all of the following main areas except
    11·2 answers
  • Jax needs to write a block of code that will organize a list of items alphabetically. Which function should he use? append() pri
    12·1 answer
  • Jeanne writes a song, and Raul wants to perform
    6·2 answers
  • Write a program which capitalize every character after full stopin a given sentence
    11·1 answer
  • True or false, USBs are slower than RAM.
    15·1 answer
  • What is your impression on the subject fundamentals of database systems?​
    7·1 answer
  • What refers to the processing of a substance or an object so that it may be used again?
    7·2 answers
  • Software is in -----language​
    5·1 answer
  • When conducting memory and recall tests, some people make an effort to normalize memories by not reporting extreme cases. this l
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!