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
asambeis [7]
3 years ago
12

(Convert milliseconds to hours, minutes, and seconds) Write a function that converts milliseconds to hours, minutes, and seconds

using the following header: def convertMillis(millis): The function returns a string as hours:minutes:seconds. For example, convertMillis(5500) returns the string 0:0:5, convertMillis(100000) returns the string 0:1:40, and convertMillis(555550000) returns the string 154:19:10. Write a test program that prompts the user to enter a value for milliseconds and displays a string in the format of hours:minutes:seconds. Sample Run Enter time in milliseconds: 555550000 154:19:10

Computers and Technology
1 answer:
ivanzaharov [21]3 years ago
4 0

Answer:

I am writing the Python program. Let me know if you want the program in some other programming language.

def convertMillis(millis):  #function to convert milliseconds to hrs,mins,secs

   remaining = millis  # stores the value of millis to convert

   hrs = 3600000  # milliseconds in hour

   mins = 60000  # milliseconds in a minute

   secs = 1000  #milliseconds in a second

   hours =remaining / hrs  #value of millis input by user divided by 360000

   remaining %= hrs  #mod of remaining by 3600000

   minutes = remaining / mins  # the value of remaining divided by 60000

   remaining %= mins  #mod of remaining by 60000

   seconds = remaining / secs  

#the value left in remaining variable is divided by 1000

   remaining %= secs  #mod of remaining by 1000

   print ("%d:%d:%d" % (hours, minutes, seconds))

#displays hours mins and seconds with colons in between

   

def main():  #main function to get input from user and call convertMillis() to #convert the input to hours minutes and seconds

   millis=input("Enter time in milliseconds ")  #prompts user to enter time

   millis = int(millis)  #converts user input value to integer

   convertMillis(millis)   #calls function to convert input to hrs mins secs

main() #calls main() function

Explanation:

The program is well explained in the comments mentioned with each line of code. The program has two functions convertMillis(millis) which converts an input value in milliseconds to hours, minutes and seconds using the formula given in the program, and main() function that takes input value from user and calls convertMillis(millis) for the conversion of that input. The program along with its output is attached in screenshot.

You might be interested in
Write a function check_palindrome that takes a string as an input and within that function determines whether the input string i
Setler79 [48]

Answer:

The function in Python is as follows:

def check_palindrome(strn):

   retstr = "Bummer. Not a palindrome."

   if strn[len(strn)::-1] ==strn:

       retstr = "Hey! That's a palindrome!"

       

   return retstr

Explanation:

This defines the function

def check_palindrome(strn):

This sets the return string to not a palindrome

   retstr = "Bummer. Not a palindrome."

This checks if the original string and the reversed string are the same

   if strn[len(strn)::-1] ==strn:

If yes, the return string is set to palindrome

       retstr = "Hey! That's a palindrome!"

This returns the expected string

   return retstr

<em>The function to reverse the string is not given; and the programming language. So, I solve the question without considering any function</em>

3 0
3 years ago
To simplify the conceptual design, most higher-order relationships are decomposed into appropriate equivalent _____ relationship
LenaWriter [7]

Answer: binary

Explanation:

Conceptual design refers to the early phase of the design process, whereby the outlines of function are articulated. The conceptual design consist of the design of processes, interactions, and strategies. It is the first stage in the database design process.

The output of the conceptual design process describes the main data entities, and constraints of a particular problem domain. To simplify the conceptual design, most higher-order relationships are decomposed into appropriate equivalent binary relationships whenever possible.

5 0
3 years ago
List and the deference between MS access objects​
Dafna11 [192]

Answer:

MS access objects help the user list , information and designed reports .

Explanation:

MS access objects are create a forms, data base, tables,queries, and modules. There are many objects are following:-Tables, Forms,Reports, Queries.

Table:- These are objects used into a define and store the data,tables are contain the columns and the store of different data.

Form:- Form is the object that designed by the data input and control application queries or tables, forms are used in viewing records.

Reports:- Reports are the designed to the printing and calculating data,reports are used because data in read to easy format.

Queries:- Queries are provides that data from one or more table,you can define the update ,delete, insert, select data.

4 0
4 years ago
.In Python, comments begin with the comment marker and continue ______.
earnstyle [38]

Answer:

b. to the end of the line

Explanation:

Great question, it is always good to ask away and get rid of any doubts that you may be having.

Python is a unique language compared to other languages such as Java and C++. In Python comments are started with the comment marker which is the hashtag (#) symbol and continues <u>to the end of the current line</u>. Once the line ends the next line is <u>NOT</u> automatically considered a comment unless another hashtag is placed.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

4 0
3 years ago
What are the differences between Cc &amp; Bcc in emails that are sent ?​
Ket [755]

Cc stands for " carbon copy " and Bcc stands for " Blind carbon copy ". The difference between Cc and Bcc is that carbon copy (CC) recipients are visible to all other recipients whereas those who are BCCed are not visible to anyone.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Amanda, a project manager, conducted a team meeting consisting of testing and development team. She insisted on clear communicat
    11·1 answer
  • What is a negative impact of digital communication
    6·1 answer
  • Why is the ipad not considered to be an enterprise-worthy device
    8·1 answer
  • Write a short java method that takes an integer n and returns the sum of all the odd positive integers less than or equal to n.
    5·1 answer
  • Given positive integer num_insects, write a while loop that prints that number doubled up to, but without exceeding 100. Follow
    8·1 answer
  • Katarina is deciding whether to buy a desktop or a laptop computer. What will most likely help Katarina make her decision?
    10·2 answers
  • To change the way a slide moves from one slide to the next, what tab should be selected?
    12·1 answer
  • When a bank account pays compound interest, it pays interest not only on the principal amount that was deposited into the accoun
    10·1 answer
  • GIVING OUT BRAINLIEST AND I AM ALSO WARNING EVERYONE TO NOT ANSWER A BUNCH OF rubbish just to get the points!
    7·2 answers
  • If you walked into a room containing three computers and were told one of them was infected with malware, how would you determin
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!