You will find where an outer planet appears in the sky and count the days on which it moves backwards. Both orbits are circles in one plane, and the Earth and the planet start in line on the same side of the Sun.
The idea. On day the Earth is at and the planet is at times . The planet's direction in the sky is the angle of the vector from the Earth to the planet, which math.atan2(y, x) gives.
Your tasks.
direction, return the planet's direction in degrees on day day.going_back, return True when the direction one day later is smaller than the direction now.count_back, count the days from -300 to 299 on which going_back is true.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…