''' One mistake which is often made in code in general, but also functions specifically (since functions especially are designed to be generic and flexible), is hardcoding. This is where one variable is set to a specific value which restricts the use cases of a particular piece of code. In this exercise, you are provided with code that calculates the maximum height of a projectile based on a fixed gravitational acceleration. The code works perfectly on Earth, but fails on other planets like Mars or Jupiter, where the gravitational constant differs. Your task is to modify the code to work in any scenario by fixing the hardcoded gravitational constant. The formula for the maximum height of a projectile is: h_max = v_0^2 * sin^2(theta) / 2g Where: * v_0 is the initial velocity * theta is the launch angle (in degrees) * g is the gravitational acceleration ''' import math def max_height(v0, theta): # Hardcoded gravitational constant for Earth g = 9.81 # m / s^2 theta_rad = math.radians(theta) h_max = (v0**2 * math.sin(theta_rad)**2) / (2 * g) return h_max # Example 1: Earth (works fine) initial_velocity = 50 # m/s angle = 45 # degrees print("Max height on Earth:", max_height(initial_velocity, angle)) # Example 2: Mars (g = 3.71 m/s², doesn't work correctly) print("Max height on Mars:", max_height(initial_velocity, angle)) ''' It is important to note that not everything needs to be 100% flexible, for example, in this case leaving the gravitational constant hardcoded might be fine, as it is highly likely you're coding something which will only ever be used on Earth and it makes the function simpler to use. This makes this a consideration between flexibility and simplicity. '''