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...

  • 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,...

  • 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))...

  • 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...

  • 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...

  • for python Introduction The purpose of this assignment is to familiarize you with the writing Python...

    for python Introduction The purpose of this assignment is to familiarize you with the writing Python scripts that demonstratest usage GUI programming. Long-Distance Calls A long-distance provider charges the following rates for telephone calls: Rate Category Daytime 6:00 a.m. through 5:59 p.m.) Evening (6:00 p.m. through 11:59 p.m.) Off-Peak (midnight through 5:59 a.m.) Rate per Minute $ 0.07 $ 0.12 $ 0.05 Write a GUI application that allows the user to select a rate category (from a set of radio...

  • PLEASE DO THIS IN PYTHON!!! 1.) Exercise #1: Design and implement a program (name it Youth)...

    PLEASE DO THIS IN PYTHON!!! 1.) Exercise #1: Design and implement a program (name it Youth) that reads from the user an integer values repressing age (say, age). The program prints out the entered values followed by a message as follows: If age is less or equal to 21, the message is “Youth is a wonderful thing. Enjoy.”. Finally, the program always prints out the message “Age is a state of mind.” Format the outputs following the sample runs below....

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
ADVERTISEMENT