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
The expressions in each part of an AND or OR expression use ________ evaluation; that is, they are evaluated only as much as nec
I am Lyosha [343]

Answer:

The expressions in each part of an AND or OR expression use <u>Short Circuit</u> evaluation; that is, they are evaluated only as much as necessary to determine whether the entire expression is true or false.

Explanation:

Logic operations follow different type of evaluation methods that can be short circuit or open circuit evaluation. In short circuit evaluation if first operand of the expression is true or false in OR or AND operation respectively, the result will found as true or false without checking the second operand of the expression. This is called Short Circuit Evaluation.

In OR operation, If first operand is true it means that the result of the expression is true without knowing that the other operand is true or false. In AND operation, If the first operand is False, the result will found as False without knowing that whether the 2nd operand is  true or false.

This Mechanism is called Short Circuit Evaluation.

4 0
3 years ago
.Although SQL is a language, you don’t use it to write applications? (true, false)
Olin [163]

Answer:

The correct answer for the given question is true .

Explanation:

SQL is an Structural query language that is used for accessing the database basically it is an query language which is used for communicating with database by executed the query .

The following are the function of SQL  

SQL can insert the data into database

it can update the record into database

SQL can retrived the database.

We do not use SQL for writing application it is only used to accessing the database  

For create application we can use programming language Like PHP,ASP,JAVA ,PYTHON.etc.

3 0
3 years ago
Explain about forensic tools?
Ganezh [65]

Answer:

 In the computer forensics, it basically examining the digital media by using the different types of specialist tools which is known as forensic tool.

It has the ability to acquiring the several evidence from the computer hard disk and by copying information, the data from the machine that can be procured and after that broke down for any data that is appropriate for the case.

There are different types of forensics tools that are:

  • SIFT (SANS Investigative Forensics Toolkit)
  • Volatility
  • Redline
  • Digitally forensics framework
  • COFEE

4 0
3 years ago
Many of today’s digital devices operate on battery power supplied by what kind of ion batteries.
stich3 [128]
"Lithium ion" is used in your cellphone.
6 0
3 years ago
How might your use of computers and knowledge of technology systems affect your personal and professional success?
RUDIKE [14]
It can help you more be aware of whats going on and what you need to do.
8 0
3 years ago
Other questions:
  • Select three examples of cryptographs. Security tokens Shared-key Malware Firewalls Message authentication code Public-key
    7·2 answers
  • What is the recommended size for bulleted text?
    5·2 answers
  • When introducing new devices to the network, the organization's security policy requires that devices be monitored to establish
    15·1 answer
  • What do you click to create a new presentation in Normal view
    14·1 answer
  • Which of the following is an advantage of batch processing?
    8·1 answer
  • We have three containers whose sizes are 10 pints, 7 pints, and 4 pints, respectively. The 7-pint and 4-pint containers start ou
    14·2 answers
  • Memory cache is referred to as ______. A. SRAM c. SROM b. DRAM d. DROM
    11·1 answer
  • Are you allowed to copy and paste answers on brainy to give answers to other people?
    5·2 answers
  • If a file you are opening for appending does not exist, the operating system will detect the missing file and terminate the oper
    14·1 answer
  • In QBasic, create a number guessing challenge. Your program should generate a random number from 1-
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!