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
Which job role requires you to create user guides for computer products and services?
Virty [35]

Answer: Technical writer

Explanation:

A technical writer is an individual who is responsible for the creation of technical documents such as user manuals, reference guides, instruction manuals, journal articles, etc.

Technical writers can work in software firms as they would be responsible for creating user guides for computer products and services.

6 0
3 years ago
When a range of IP addresses is set aside for client devices, and one of these IPs is issued to these devices when they request
Pepsi [2]

Answer:

The answer is "Dynamic".

Explanation:

The dynamic allocation of the IP address describes the difference from once in a while, unlike with a static IP address.  

  • In this many residential networks are work on different IP addresses, which requires, and provides clarification.
  • It is also known as an economical, Provides by "ISP" to allocate a dynamic IP address to certain subscribers.
7 0
3 years ago
Typing which capitals and exclamation points in an email is an example of
Alexus [3.1K]
It's an example of a poorly written email, it looks like somebody is angry and yelling at you, these types of emails can be described as a poor etiquette.
4 0
3 years ago
How can i do a back up on one computer and save it to the hard drive in another computer without it being seen by others on the
Ganezh [65]
Unless you share the backup HD only the local user is going to see it. Given that it's a server, it's not a problem. You can also hide the backup with attributes +h +s and many other ways.
8 0
3 years ago
If you've finished working with a data file but intend to work on it again during your work session, which button would you use
mariarad [96]
Hey there! Hello!

So, not sure if there's actually a button to "close out" a window to where you're able to reopen it again without having to go to where the file is located or go to recents in your application. Keep in mind that I'm on a MacBook, but I have worked on a Windows computer before. 

One thing you can do is minimize the window. Your program will remain open, but your window will remain out of your way until you decide to expand it again. This seems to be the closest thing possible to your description, but if you had something else in mind, I'd love to hear more details.

This won't be a good solution if you're looking to cut down on the energy that certain programs may be taking up while open, even if you're not using them. But in terms of getting the windows off your desktop, minimizing is the way to go. It also allows you to have documents/windows out of the way while still being able to work on other documents/windows in the program (i.e. Microsoft Word, Google Chrome, Pages, etc.)

Hope this helped you out! Feel free to ask me any additional questions you may have. :-)
5 0
3 years ago
Read 2 more answers
Other questions:
  • A patent facilitates a government-approved technological monopoly by
    5·1 answer
  • How can you differentiate between standard and protocol? Write at least on example of each of these terminologies?
    12·1 answer
  • It can be useful to have a mentor because they will help you
    7·2 answers
  • What is the term used for the document that describes the scenes and sequence of a game?
    6·1 answer
  • What are some good websites i can use to test my knowledge?
    11·2 answers
  • Is this a Bad Cpu processor ? I need some.help ASAP I turn on my.pc and it has no display but everything is on fans and the you
    13·1 answer
  • In C!!
    11·1 answer
  • What<br>are<br>the features of secondary storage media​
    13·2 answers
  • Which element is represented by the electron configuration in example B? Example B: 1s22s22p63s23p64s1 Aluminum Cesium Potassium
    12·2 answers
  • QUICK HELP ME PLEASE
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!