Example 1
Input absolute luminosity: 1.11
Input exoplanet distance: 1.04
Output habitability: "just right"
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.
Difficulty | Timesink | ||
---|---|---|---|
Function | habitable_exoplanet(absolute_luminosity, planet_distance) |
You must be logged in to view your submissions.
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.