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
1. Name the first PC virus.<br> 2. In which language are viruses written for Microsoft programs?
Tju [1.3M]

Answer:

The first IBM PC virus in the "wild" was a boot sector virus dubbed (c)Brain, created in 1986 by Amjad Farooq Alvi and Basit Farooq Alvi in Lahore, Pakistan, reportedly to deter unauthorized copying of the software they had written. The first virus to specifically target Microsoft Windows, WinVir was discovered in April 1992, two years after the release of Windows 3.0.

Explanation:

HOPE THIS HELPS

6 0
3 years ago
Read 2 more answers
Who knows a website to learn how to code in java?
Murrr4er [49]
Simple...

Although we are not allowed to link in websites..(against guidelines) you can search up codeacademy, this is a place to learn to code.

Thus, your answer.
6 0
3 years ago
What are the max amount of warnings you get before you get banned?
Olenka [21]

Answer:

I'm not sure but I just got a warning from this person Kaite....

5 0
3 years ago
Read 2 more answers
This was not a "true" operating system, but rather an operating environment.
olya-2409 [2.1K]

Answer:

Windows 1.0

Explanation:

It is known as Microsoft Windows first version.  Windows 1.0 is actually an operating environment which providesgraphical programs designed for windows and MS-DOS, a running environment.

7 0
3 years ago
How can you minimize a bad background? In other words, how can you make less of a bad background show up in the photo?
Aneli [31]
What you want to do is create a shallow depth of field, this is to make your background blur and focus more on the subject. Set a large aperture, which is a low f-number, around f/1.8 or f/2 and then take a few test shots to see if this is what you would like. If you want everything to be focused in frame just do the opposite.
6 0
3 years ago
Other questions:
  • If I were to install python in kali linux on a Acer 11 Chromebook and C730 would I be able to hack python with it since I have n
    15·1 answer
  • Derek has an interest in designing video games. What requirements should he fulfill to be a game designer?
    13·1 answer
  • ____ are the computers that store network software and shared or private user files.
    6·1 answer
  • What is indirect recursion?
    14·1 answer
  • How do you choose the amount of points you give a person here on this brainless app...??.
    11·2 answers
  • Which type of financial institution typically has membership requirements?
    11·1 answer
  • How many of yall are willing too sub to my channel called "Space Juice" with around 200 subs?!​
    11·1 answer
  • What is the build in libary function to compare two strings?​
    15·1 answer
  • The following code will not compile. Which of the options below would allow the code to compile and run as intended?
    9·1 answer
  • Who want a rap song if yes try to rap too this Can you move it like this? I can shake it like that
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!