Welcome to Project Lovelace! We're still in early development so there are still tons of bugs to find and improvements to make. If you have any suggestions, complaints, or comments please let us know on Discourse, Discord, or GitHub!

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.


Image credit: The Center for Planetary Science

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
 Function habitable_exoplanet(absolute_luminosity, planet_distance)

You must be logged in to view your submissions.

Notes

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. Would be nice if you don't post solutions in there but if you do then please organize and document your code well so others can learn from it.