Write the code. LANGUAGE: PYTHON Python question Your friend lives in London, England in a timezone that
Fantastic news! We've Found the answer you've been seeking!
Question:
Write the code.
LANGUAGE: PYTHON
Python question
Transcribed Image Text:
Your friend lives in London, England in a timezone that is normally 6-hours ahead of Toronto, Canada. But sometimes England and Canada switch to daylight savings time on different dates. If Toronto is on daylight savings time and London is not, then the time difference is only 5-hours. Conversely, if London is on daylight savings time and Toronto is not, the time change is 7-hours. Of course, if both are on daylight savings time, the difference is back to the standard 6-hours. Write the function british_time whose first parameter is a float value representing the time in Toronto as 24-hour time. The next two parameters are booleans indicating whether Toronto and London are on daylight savings time, respectively. Your function should return the time in London as a float. One last complication is that your function should not return a time greater or equal to 24.0 or less than 0.0. Suggestion: at first do not consider this final complication and write test cases where the expected output is already less than 24.0 (in the same day). Once that is working, add a test case where the time in Toronto is so late at night that London is already the next morning. Fix the body of your function to work correctly. Your friend lives in London, England in a timezone that is normally 6-hours ahead of Toronto, Canada. But sometimes England and Canada switch to daylight savings time on different dates. If Toronto is on daylight savings time and London is not, then the time difference is only 5-hours. Conversely, if London is on daylight savings time and Toronto is not, the time change is 7-hours. Of course, if both are on daylight savings time, the difference is back to the standard 6-hours. Write the function british_time whose first parameter is a float value representing the time in Toronto as 24-hour time. The next two parameters are booleans indicating whether Toronto and London are on daylight savings time, respectively. Your function should return the time in London as a float. One last complication is that your function should not return a time greater or equal to 24.0 or less than 0.0. Suggestion: at first do not consider this final complication and write test cases where the expected output is already less than 24.0 (in the same day). Once that is working, add a test case where the time in Toronto is so late at night that London is already the next morning. Fix the body of your function to work correctly.
Expert Answer:
Answer rating: 100% (QA)
CODE Function to convert time in toronto to time in London def britishtimetortime tordaysav londaysa... View the full answer
Related Book For
Canadian Income Taxation Planning And Decision Making
ISBN: 9781259094330
17th Edition 2014-2015 Version
Authors: Joan Kitunen, William Buckwold
Posted Date:
Students also viewed these electrical engineering questions
-
Natural language processing using Python NLTK package, WILL RATEASAP E-book:http://victoria.lviv.ua/html/fl5/NaturalLanguageProcessingWithPython.pdf Question: Complete the following subparts, in the...
-
2. (10 points) Write a program named hw2_2. cpp that asks the user to enter the number of seconds as an integer value and that then displays the equivalent time in days, hours, minutes, and seconds....
-
The Language is Python 3 4. ASCII Art [20 points] Write a function cross (n, m) that prints a picture of an n x m cross as pictured below. The cross should consist of a horizontal line made of minus...
-
Which of the following industries would most likely have the highest ratio of sales revenue to property, plant and equipment? Question 9 options: 1) Airline 2) Consumer product manufacturing company...
-
The market interest rate if is 12% per year compounded semiannually. For an inflation rate of 2% per 6 months, the effective semiannual interest rate is closest to: (a) 2% (b) 3% (c) 4% (d) 6%
-
Draw the AVL tree resulting from the removal of the entry with key 62 from the AVL tree of Figure 11.13b. 4 62 44 78) 50 88 48 54 T4 T2 (b)
-
Assume that IHOP sold all 1,000 shares of its treasury stock for \(\$ 15\) per share. The sale of treasury stock a. Decreased total equity by \(\$ 15,000\) b. Increased total equity by \(\$ 5,000\)...
-
Finding Financial Information Refer to the financial statements of American Eagle given in Appendix B at the end of this book. Required: 1. What is the amount of accrued compensation and payroll...
-
Part B: Create TWO graphs, y = f(x) which satisfy the given property: f'(x) > 0 if x < -3 or x > 3 Additionally, each of your graphs must satisfy ONE of the properties from part A: f'(-3)= f'(3) = 0...
-
Usonic, Inc., has collected the following information on its cost of electricity: Required a. Prepare a scattergraph of Usonic's electricity costs for the year. Plot the total electricity cost on the...
-
AIM: Write a C program to evaluate the series sum=1-x+x^2/2!- x^3/3!+x^4/4!.....-x^9/9!
-
PLEASE ANSWER THE 2 QUESTIONS AT THE TOP, THE EXPERIMENT IS BELOW. 1. Write down the mechanism showing the movement of electrons to form the product from starting materials. 2. H NMR of...
-
How do gene flow and genetic drift influence the process of allopatric speciation, and in what ways can these mechanisms lead to reproductive isolation between diverging populations ?
-
Given matrix A shown below, find -4A. Give your answer as a matrix using the matrix tool. Provide your answer below: 3 -2 A = 0 0 2 -4 3 5
-
Jon Seceda Furnace Corp. purchased machinery for $315,000 on May 1, 2025. It is estimated that it will have a useful life of 10 years, salvage value of $15,000, production of 240,000 units, and...
-
An air conditioner uses 1 0 2 4 3 J of energy to run but only 6 0 2 3 J energy is used to heat or cool the air in the home what is the energy efficiency
-
Discuss how AJAX communicates with the server using XMLHttpRequest object. Explain XMLHttpRequest object with its properties and methods
-
Pappa's Appliances uses the periodic inventory system. Details regarding the inventory of appliances at January 1, purchases invoices during the year, and the inventory count at December 31 are...
-
What are the tax consequences to a corporation and its shareholder when that corporation declares a dividend but, instead of paying cash, distributes to the shareholder property that has a value...
-
How does the treatment given eligible capital property differ from that given depreciable property?
-
Bill owns a 5% interest in a limited partnership. The adjusted cost base of his partnership interest at the beginning of the current year was $40,000. For the current year Bill was allocated $8,000...
-
A computer chip is essentially a series of micro-sized transistors that function as tiny switches to control the flow of electrons. Millions, sometimes billions, of transistors are packed into chips...
-
Raul Suarez is the factory manager for Tallis Manufacturing, which manufactures metal propellers for small boats. The factory uses hot plastic and metal work in the production process, so the factory...
-
Look at Figure 26.1. For either the UK or the EU: a. Estimate the amplitude of the deviations from trend over the period shown. b. Estimate the length of time between the beginning of the deviation...
Study smarter with the SolutionInn App