write a program to calculate The difference between two datetime Ask the user to enter the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
write a program to calculate The difference between two datetime Ask the user to enter the first date in the format (YYY/MM/DD HH:MM) or any format you want . Ask the user to enter the second date in the format (YYY/MM/DD HH:MM) or any format you want If the second date is before the first day . . o just print an error message and quit the program Calculate the difference between the two dates o Print the difference in terms of days and hours ex: the difference is 3 days and 2 hours . • Assume the user will enter bad dates o if the user enters bad data, you should print an elegant message and exit the program . the bad data can be 2020/04/31 # April 31st does not exist Seattle # you asked for a date, they entered a string o You can use try-except that you learned on Chapter 8 write a program to calculate The difference between two datetime Ask the user to enter the first date in the format (YYY/MM/DD HH:MM) or any format you want . Ask the user to enter the second date in the format (YYY/MM/DD HH:MM) or any format you want If the second date is before the first day . . o just print an error message and quit the program Calculate the difference between the two dates o Print the difference in terms of days and hours ex: the difference is 3 days and 2 hours . • Assume the user will enter bad dates o if the user enters bad data, you should print an elegant message and exit the program . the bad data can be 2020/04/31 # April 31st does not exist Seattle # you asked for a date, they entered a string o You can use try-except that you learned on Chapter 8
Expert Answer:
Answer rating: 100% (QA)
Python import datetime Ask the user to enter the first date in the format YYYMMDD HHMM def getfirstdate while True try firstdate inputEnter the first date in the format YYYYMMDD HHMM firstdate datetim... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
1. Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D, and F, possibly followed by + or -. Their numeric values are 4, 3, 2, 1 and 0. There is no F+ or...
-
You would like to construct a 95% confidence interval to estimate the population mean price of milk (per gallon) in your city. You select a random sample of prices from different stores. The sample...
-
Describe the energy transformations when a child hops around on a pogo stick.
-
Refer to question 8. What will Mary and Martys credit limit be if the bank uses the market value of equity to determine their credit limit and will loan them 70% of the equity? In Question 8 Mary and...
-
In 2001, the City of New York and the Dormitory Authority of the State of New York (DASNY) entered into an agreement to build a forensic biology laboratory in Manhattan. Per the agreement, DASNY...
-
Fernando Company manufactures pizza sauce through two production departments: Cooking and Canning. In each process, materials and conversion costs are incurred evenly throughout the process. For the...
-
why is cardinality important to a relational database model? How is it usually defined and what types of GIS analysis operations is it particularly important to? Provide specific examples in your...
-
The owner of Neros company has hired you to analyze her company's performance and financial position, as well as the positions of Iits competitors, Centar and Xermix. However, the data Neros abtained...
-
I want to start writing a weekly post on Linkedin that lightly analyses M&A activity - particularly in the resources/energy/commodities sector but in other sectors as well. Can you please build a...
-
describe the negative effect of the 3d printing in logistic industry
-
WHAT IS THE INTRINSIC RELATIONSHIP BETWEEN MARKETING AND GLOBAL SALES?
-
Describe three challenges posed by the exponential economic growth and market competition
-
1) JRC Inc has purchases of $300,000, a starting inventory of $50,000 and the cost of goods sold is $175,000, what is the dollar amount of its ending inventory? a) $175,000 b) $240,000 c) $265,000 d)...
-
What is the theoretical framework and operational methodology behind the "bridge to the future" technique employed within natural language processing (NLP), and how does it contribute to enhancing...
-
3. A 100-ml. graduated cylinder is filled with water to a volume of 50,0 mL.. A piece of copper metal (d = 8.92 g/mL.) with a mass of 23.9 g is added to the water in the cylinder. To what level will...
-
A condenser (heat exchanger) brings 1 kg/s water flow at 10 kPa quality 95% to saturated liquid at 10 kPa, as shown in Fig. P4.91. The cooling is done by lake water at 20C that returns to the lake at...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family. The Incisors own a rental beach house in Hawaii. The beach house was rented for the full year during 2012...
-
Frank Willingham has the following transactions during the year: Sale of office equipment on March 15 that cost $20,000 when purchased on July 1, 2010. Frank has claimed $5,000 in depreciation and...
-
Bea Jones (age 32) moved from Texas to Florida in December 2011. She lives at 654 Ocean Way, Gulfport, FL 33707. Bea's Social Security number is 466-78-7359 and she is single. Her earnings and income...
-
Mega Tech, Inc. designs and manufactures automotive components. For years, the company enjoyed a stable marketplace, a small but loyal group of customers, and a relatively predictable environment....
-
Describe the features of a project. How do they differ from day-to-day processes within an organization?
-
In 2003, the Department of Health and Human Services in Victoria, Australia, initiated a AU$323 million project to develop HealthSMART, an integrated IT system that would deliver resource management,...
Study smarter with the SolutionInn App