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
Cerrena [4.2K]
2 years ago
13

Write a function called mul_time that takes a Time_Elapsed object and a number and returns a new Time_Elapsed object that contai

ns the product of the original object and the number. Then use mul_time to write a function that takes a Time_Elapsed object that represents the finishing time in a race, and a number that represents the distance, and returns a Time object that represents the pace (time per mile). The function should return a nicely formatted pace in hour, minutes and second per mile
Computers and Technology
1 answer:
lisov135 [29]2 years ago
7 0

# Write a function called mul_time that takes a Time object and a number and

# returns a new Time object that contains the product of the original Time and

# the number.

# Then use mul_time to write a function that takes a Time object that

# represents the finishing time in a race, and a number that represents the

# distance, and returns a Time object that represents the average pace (time

# per mile).

# Current Status: Complete

class Time(object):

   """ represents the time of day.

   attributes: hour, minute, second"""

time = Time()

time.hour = 3

time.minute = 0

time.second = 0

def time_to_int(time):

   minutes = time.hour * 60 + time.minute

   seconds = minutes * 60 + time.second

   return seconds

def int_to_time(seconds):

   new_time = Time()

   minutes, new_time.second = divmod(seconds, 60)

   time.hour, time.minute = divmod(minutes, 60)

   return time

def mul_time(time, multicand):

   time_int = time_to_int(time) * multicand

   new_time = int_to_time(time_int)

   if new_time.hour > 12:

       new_time.hour = new_time.hour % 12

#    print ("New time is: %.2d:%.2d:%.2d"

#    % (new_time.hour, new_time.minute, new_time.second))

   return new_time

# mul_time(time, 2)

def race_stats(time, distance):

   print ("The finish time was %.2d:%.2d:%.2d"

         % (time.hour, time.minute, time.second))

   print "The distance was %d miles" % (distance)

   average = mul_time(time, (1.0 / distance))

   print ("The average is: %.2d:%.2d:%.2d per mile"

         % (average.hour, average.minute, average.second))

race_stats(time, 3)

You might be interested in
I am not a living being, I am a cylindrical shape that has three to eight sides. I never die. I can build anything again. What i
Setler79 [48]

Answer:

A shape

Explanation:

4 0
3 years ago
Enumerate five features of Microsoft excel 2016​
Trava [24]

Answer:

Smarter Autocorrect, Improved Functions of Excel Workbook, New Funnel charts, and Smarter insertion of pictures.

Explanation:

For 8 features of Microsoft excel 2016, check out this website:

https://www.educba.com/features-of-2016-excel-workbook/

Hope this helps!

7 0
1 year ago
There is a feature that allows you to lock the document, to avoid others making changes. True or False
Burka [1]

Answer:

yes there is

Explanation:

6 0
3 years ago
write a program to update the rate by increasing 20% from sequential data file "items.dat" that store item name.rate and quantit
sveticcg [70]

Answer:

your answer is in the pic

(◔‿◔)

。◕‿◕。

6 0
2 years ago
An online supermarket wants to update its item rates during the sales season. They want to show the earlier rates too but with a
cupoosta [38]
Cheaper elements gives a strike through appearence
7 0
3 years ago
Read 2 more answers
Other questions:
  • A set of communication rules for the computer to follow is called, what?
    10·2 answers
  • What tab must you click on to view any previously read messages from instructors in the message center?
    14·2 answers
  • 1⁰=?<br> Is equal to...........
    12·2 answers
  • What should you remember when using the thesaurus to replace words?
    8·2 answers
  • The 7-bit ASCII code for the character ‘&amp;’ is: 0100110 An odd parity check bit is now added to this code so 8 bits are trans
    12·1 answer
  • Assume that a 5 element array of type string named boroughs has been declared and initialized. Write the code necessary to switc
    5·1 answer
  • If you give an actual answer I'll give brainliest​
    13·2 answers
  • A digital forensic analyst examines the original digital source (e.g. computer, flash drive, backup tape) suspected of being inv
    5·1 answer
  • How do i stop my computer from automatically connecting to a wireless network
    5·1 answer
  • What role do play in medicine ​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!