Question
python

Question 4: (Textbook Page 82, Q38) Python comes with hundreds of modules. Here is a challenge for you: find a module that yo
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code:

import datetime
print("the date today is:",datetime.datetime.now().strftime('%y-%m-%d'))

#source code with output:

i 2 import datetime print(the date today is:, datetime.datetime. now().strftime(%Y-%m-%d)); Terminal File Edit View Searc

#source code:

#source code:

jd=int(input("please enter the number of days John has worked:"))
jh=int(input("please enter the number of hours John has worked:"))
jm=int(input("please enter the number of minutes John has worked:"))
bd=int(input("please enter the number of days Bill has worked:"))
bh=int(input("please enter the number of hours Bill has worked:"))
bm=int(input("please enter the number of minutes Bill has worked:"))
total_days=jd+bd
total_hours=jh+bh
total_minutes=jm+bm
if(total_minutes>60):
total_hours+=(total_minutes//60)
total_minutes=total_minutes%60
if(total_hours>24):
total_days+=(total_hours//24)
total_hours=total_hours%24
print("The total time both of them worked together is:{} days,{} hours and {} minutes.".format(total_days,total_hours,total_minutes))

jd=int(input(please enter the number of days John has worked :)) jh=int(input(please enter the number of hours John has wo

#output:

user user-Latitude - 3490:-/Desktop $ python3.7 star.py please enter the number of days John has worked: 2 please enter the n

#if you have any doubt comment below...if you like give thumbs up..

Add a comment
Know the answer?
Add Answer to:
python Question 4: (Textbook Page 82, Q38) Python comes with hundreds of modules. Here is a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • use Python and please comments every step. [25] 6. Write a program that reads from standard...

    use Python and please comments every step. [25] 6. Write a program that reads from standard input, two times in military format and prints the number of hours and minutes between the two times. Assume that the second time is always ahead of the first time. You should avoid using conditional statement (if-else) for this program. Your program must query the user for the two times and output the difference based on the two sample runs given below. Please enter...

  • please help by python compiler Suppose the temperature of your coffee is 125 degrees Fahrenheit. You...

    please help by python compiler Suppose the temperature of your coffee is 125 degrees Fahrenheit. You want to drink it at 110 degrees. A chip of ice turns out to lower the temperature one degree each time. You test the temperature each time. and also print out the temperature before reducing the temperature. Write a code in python for this. The number of views of a Youtube Channel was increasing in the order of 5.8,13,21,34 for the first 5 days....

  • I need help with this python programming exercise, please! thanks in advance Create a Python script...

    I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...

  • Python Please help Write a program that asks the user to enter a number of seconds...

    Python Please help Write a program that asks the user to enter a number of seconds and then prints the same amount of time in days, hours, minutes, and seconds. For example, 3667 seconds is equivalent to 0 days, 1 hour, 1 minute, and 7 seconds. Print out the result in the format: "0 day(s), 1 hour(s), 1 minute(s), and 7 second(s)." SAMPLE RUN #4: python3 TimeCalculator.py Interactive SessionStandard InputStandard Error (empty)Standard Output Hide Invisibles Highlight: NoneStandard Input OnlyPrompts OnlyStandard...

  • Lab 8 python code for Cell Phone Bill

    Lab 8: Cell Phone Bill CalculatorWrite the Python code for the following programming problem definition.Use modular design according to the modules specified below.Design and write a program that calculates and displays the number of minutes over the monthly contract minutes that a cell phone user incurred. The program should askthe user how many minutes were used during the month and how many minutes they were allowed. Validate the input as follows:• The minimum minutes allowed should be at least 100,...

  • Project 5 - intro to python Write a program in python that calculates the amount of...

    Project 5 - intro to python Write a program in python that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, four pennies the third day, and continues to double each day. Output the amount earned each day .. and the total pay at the end. The Algorithm (Plan) for your program would be: Ask the user for the...

  • This problem demonstrates the use of import module. The Python programming language has many strengths, but...

    This problem demonstrates the use of import module. The Python programming language has many strengths, but one of its best is the availability to use many existing modules for various tasks, and you do not need to be an experienced computer programmer to start using these modules. We have given you some incomplete code; note that the very first line of that code contains an import statement as follows: import math This statement enables your program to use a math...

  • In python.. If we want the computer to pick a random number in a given range...

    In python.. If we want the computer to pick a random number in a given range say to write code for Picking a random element from a list or pick a random card from a deck, flip a coin etc. we can use Random module The Random module contains some very useful functions one of them is randrange() randrange(start, stop) Example from random import randrange for i in range (3): print ("printing a random number using randrange(1, 7)",r andrange(1, 7))...

  • 4. For the following problem submit a photo of the flowchart and shots of your Python...

    4. For the following problem submit a photo of the flowchart and shots of your Python screens showing the program code and the output. Your task is to input from the teacher the test score of each student and to output the highest score. You need to check each score to make sure it is valid (at least 0 and at most 100). If it is not valid, keep prompting for a valid score until you get one. After a...

  • INSTRUCTION AND PROBLEMS Write a Python program for each of the problems in this lab. Please...

    INSTRUCTION AND PROBLEMS Write a Python program for each of the problems in this lab. Please use PyCharm to type and test your programs. Submit the Python files to Blackboard for credit. In this lab, you should submit 4 Python files, one for each problem PROBLEM I Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use in a month, the higher the energy bll. A power company charges customers $0.12 per kWh for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT