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
Is a storyboard an example of an implemation tool?
goblinko [34]
Yes, the answer is true.
8 0
3 years ago
Read 2 more answers
an organization that maintains a gateway to the Internet and rents access to customers on a per-use of subscription basis\ and W
shtirl [24]
1. An organisation that maintains a gateway to the internet and rent access to customers on a per use of subscription basis is called INTERNET SERVICE PROVIDER [ISP]. Internet service providers are of various forms, it can be commercially or privately owned, it can also be owned by a community. The internet access provided by ISP can be inform of cable, DSL or dial up. ISP provide other services such as website building and virtual hosting.
2. Internet protocol [IP] refers to a set of rules that guide the format of data sent over the internet, it is the method by which data is sent over the internet from one computer to another computer. Each computer that is linked to the internet has a unique IP address by which it is identified and distinguished from all other computers on the internet.
8 0
2 years ago
Which is a feature of audio editing software?
riadik2000 [5.3K]
D. It is used to add sound effects.
Hope this helps!
5 0
3 years ago
Read 2 more answers
Discovery of user requirements, existing system evaluation, and logical system design are part of the _____ phase of the Systems
natulia [17]

Answer:

analysis

Explanation:

4 0
2 years ago
Write a computer program to tell if the number is even or odd please
vovikov84 [41]
There you go :) Written in C# you can add using tags yourself I believe

3 0
3 years ago
Other questions:
  • What are the advantages and disadvantages of the simulated link strategy?
    11·1 answer
  • You use different office apps to accomplish specific tasks, such a creating a newsletter or producing a sales presentation, yet
    8·1 answer
  • An example of an electrical insulator is _____.
    15·1 answer
  • The _____ is a blinking vertical line that indicates where the next typed character will appear. scroll box sheet tab insertion
    7·1 answer
  • Why is network security important? Check all of the boxes that apply. A. Network security allows organizations to continue to fu
    8·1 answer
  • How to automatically ccleaner smartphone?
    10·1 answer
  • One friend claims that a dual-core system runs at twice the speed as a single-core system; another friend disagrees by saying th
    13·1 answer
  • This method adds newValue to the list at the specified index. If the index is invalid for the list, throw an IndexOutOfBoundsExc
    13·1 answer
  • Which of the following symbols is a part of all spreadsheet functions?
    7·2 answers
  • which server edition doesn't support any server roles that you would typically use with standard version
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!