Attention, Earthlings!
We believe we've discovered some vital information about the Zorbs - They come from a distant planet with a unique climate and temperature system. As scientists around the world eagerly await the opportunity to communicate with our visitors, they have uncovered a crucial piece of information: the Zorblatrons measure temperature using a unit called "Gelvox."
We believe "Gelvox" could be derived from the alien language, where "gel" represents the state of matter (similar to "solid," "liquid," or "gas" in English) and "vox" signifies a unit or measurement. So, "Gelvox" would literally mean the unit of temperature in the alien language, indicating how the Zorblatrons perceive and quantify thermal energy.
According to initial observations and communications with the Zorblatrons, their temperature unit, Gelvox (G), is quite different from anything we've encountered on Earth. Fortunately, our scientists have managed to decipher the conversion equations between Gelvox and Celsius, allowing us to understand and communicate temperatures effectively with our new interstellar neighbors.
Challenge:
Your task is to implement a program that converts temperatures between Gelvox and Celsius. You will write two functions:
gelvox_to_celsius(gelvox: float) -> float: This function takes a temperature in Gelvox and returns the equivalent temperature in Celsius. Use the following equation to perform the conversion:
Celsius = Gelvox/2 + 10
celsius_to_gelvox(celsius: float) -> float: This function takes a temperature in Celsius and returns the equivalent temperature in Gelvox. Use the following equation to perform the conversion:
Gelvox=2×(Celsius−10)
You should write a program that allows users to convert temperatures between Gelvox and Celsius. The program should repeatedly prompt the user to choose an operation (conversion from Gelvox to Celsius or from Celsius to Gelvox) and input the temperature they wish to convert until they choose to exit.
Write the functions that implement the conversion equations provided.
Create a program that repeatedly prompts the user to choose an operation and input the temperature they wish to convert until they choose to exit.
Ensure your program handles invalid inputs gracefully.
Test your program with various temperature values to verify its correctness.