Question: Write the code. LANGUAGE: PYTHON Python question Your friend lives in London, England in a timezone that is normally 6-hours ahead of Toronto, Canada. But

Write the code. 

LANGUAGE: PYTHON

Your friend lives in London, England in a timezone that is normally

Python question

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.

Step by Step Solution

3.43 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

CODE Function to convert time in toronto to time in London def britishtimetortime tordaysav londaysa... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Electrical Engineering Questions!