londonHour | pghHour(londonHour) |
0 (midnight) | 7 (7pm) |
10 (10am) | 5 (5am) |
12 (noon) | 7 (7am) |
17 (5pm) | 12 (noon) |
18 (6pm) | 1 (1pm) |
Note: the hardest part
is when it is 12 o'clock in Pittsburgh.
where:
This isn't quite as simple as it seems, because your
solution for x will not only be approximate (and not exactly an int, so
you'll have to do something about that), but it may not even be real!
Though the solution is real, the intermediate steps may include some complex
values, and in these cases the solution will include a
(possibly-negligibly-small) imaginary value. So you'll have to convert from
complex to real (see hint above), and then convert from real to int.
Great, now you have one root. What about the others? Well, we can divide
the one root out and that will leave us with a quadratic equation, which of
course is easily solved. A brief, clear explanation of this step is
provided
here. Don't forget to convert these to int values, too!
So now you have all three int roots. Great job! All that's left is to sort
them. Now, if this were later in the course, you could put them in a list
and call a built-in function that will sort for you. But it's not, so you
can't. Instead, figure out how to sort these values using the limited
built-in functions and arithmetic available this week. Then just return
these 3 values and you're done.
Good luck!!!
carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem