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
Hi, I just ate a hot banana that I cooked in the oven.
mrs_skeptik [129]
Banana fish .. pain. all i know is pain.
4 0
4 years ago
Read 2 more answers
WHAT IS SQL AND HOW CAN YOU MEET THE DATA REQUIREMENTS ALSO MAINTAINING DATA INTEGRITY,AND LASTLY STATE THE FULL MEANING OF SQL
castortr0y [4]
SQL stands for Structured Query Language, it is a standard query language that is used in a computer usually used for manipulation of data in a system through its database management by using its query codes or commands. It is widely used in database management and manipulation because it use a CRUD query method or Create, Update, Delete and Insert of data in the database.
5 0
4 years ago
Which block in this module represents the variable?
sasho [114]

Explanation:

jdbfifnmathljnfeijrjdjej.http.com

6 0
3 years ago
Greg is the purchasing manager at a jeans-manufacturing company. He knows he could save his company money by using cheaper, thin
pychu [463]

Answer:

Option (B) i.e., character is the correct answer to the following question.

Explanation:

Because the character quality demonstrates the ability of honesty, loyalty, and integrity, etc that shows the positive character of the person and Greg has good character quality because he thinks about their customers before he thinks about the money. So, that's why Greg shows the quality of the good character and he also loyal about their work.

8 0
3 years ago
What is procurement? Multiple Choice The purchasing of goods and services to meet the needs of the supply chain Includes the pro
fomenos

Answer:

The purchasing of goods and services to meet the needs of the supply chain

Explanation:

Procurement is usually associated with the buying of goods required to meet the need of the organisation.

The procurement department of any organizations is charged with the responsibility of purchasing goods and services for the organizations; they fill up whatever void is existing in the goods and services needed by the organisation.

6 0
3 years ago
Read 2 more answers
Other questions:
  • The numbers on the bottom of a typical check represent all of the following EXCEPT?
    12·2 answers
  • You can use a(n) ____ to visually separate related controls from other controls on the form.
    8·1 answer
  • What type of encoding is this?<br>0x6a656c6c7966697368<br>cause I'm trying to decode it
    5·1 answer
  • You are the systems administrator for a scientific research company that employs over 100 scientists who write and run Linux pro
    13·1 answer
  • True or false: if we’re short side the subject in our composed frame, we have given the subject the maximum amount of “lead room
    15·1 answer
  • Bulleted and Numbered List button appear in the ………….. Toolbar.​
    6·1 answer
  • True/False/Unknown. For the interpretation of function calls, we assign the formal parametersto the valuations of the actual arg
    11·1 answer
  • Kali, a Python programmer, is using the turtle module to write the word "hello." Which code should she use to indicate the locat
    9·2 answers
  • Write a structured algorithm that prompts the user to input the name and price of an item and the quantity purchased. It should
    10·1 answer
  • A. Fill in the blanks:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!