Welcome to Project Lovelace! We're still super new so there are still tons of bugs to find and improvements to make. If you have any suggestions, complaints, or any comments at all please let us know on Discourse!

Habitable exoplanets

You will learn about: exoplanets and habitable zones.

An exoplanet is a planet orbiting a star other than our sun and we can actually detect these planets now! It turns out there are a lot of exoplanets and everyone is wondering whether anything lives there. How far the exoplanet is from its host star can determine whether it can support life or not. If it's too close to the star the planet would be too hot for life to survive there. Too far and now it's too cold to support life. There is a sweet spot in between called the circumstellar habitable zone (CHZ) in which a planet's surface is just the right temperature to support liquid water: not too hot and not too cold.

One simple definition is that the CHZ is a ring around the star (the green zone in the figure) with inner radius $\displaystyle r_i = \sqrt{\frac{L}{1.1}}$ and outer radius $\displaystyle r_o = \sqrt{\frac{L}{0.54}}$. The radii $r_i$ and $r_o$ are given in astronomical units or au (1 au is roughly the distance between the Sun and the Earth) and $L$ is the star's luminosity as a multiple of the Sun's luminosity.

Given a star's absolute luminosity $L$ and the planet's distance from the star $r$ as inputs, return "too hot" if the planet is too close to the star, "too cold" if it's too far away from the star, and "just right" if it's in the CHZ.

Input: The star's absolute luminosity $L$ and the planet's distance from the star $r$.

Output: The string "too cold" if the planet is too far away, "too hot" if it is too close, or "just right" if it is within the CHZ.

Example 1

Input absolute luminosity: 1.11 Input exoplanet distance: 1.04 Output habitability: "just right"

Example 2

Input absolute luminosity: 1.5 Input exoplanet distance: 2.5 Output habitability: "too cold"

 Difficulty  Timesink 60 s 250 MiB habitable_exoplanet(absolute_luminosity, planet_distance)

Write a function that accepts the input as function parameters and returns the correct output. Make sure to read the description above to produce the correct output in the correct format and use the correct function signature so we can run your code. A good first step is to try reproducing the example(s). Your code must not take longer than the maximum runtime to run and must not use more memory than the allowed limit.

You must be logged in to view your submissions.

### References

Kasting, J.F. (1996), Habitable zones around stars: An update. In: Doyle, L. (ed.). Circumstellar Habitable Zones, pp. 117-142.
Gave the boundaries used in this problem but there are other attempts, including many recent ones. We just used this one for simplicity. We could not find the chapter referenced online so we scanned a copy and uploaded it on here.

Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion thread below. Feel free to post your solutions but if you do please organize and document your code well so others can learn from it.