diff --git a/solutions/temperature_converter.py b/solutions/temperature_converter.py index 9db1fa47c..32335d486 100644 --- a/solutions/temperature_converter.py +++ b/solutions/temperature_converter.py @@ -1,4 +1,4 @@ -# Function that converts celsius to Fahrenheit +# Function that converts Celsius to Fahrenheit def celsius_to_fahrenheit(celsius): """ Converts the inputted temperature from Celsius to Fahrenheit. @@ -9,6 +9,7 @@ def celsius_to_fahrenheit(celsius): return (celsius * 9 / 5) + 32 +# Ensure this code block only executes when the script is run directly if __name__ == "__main__": # Get user input celsius = float(input("Enter temperature in Celsius: ")) @@ -16,6 +17,5 @@ def celsius_to_fahrenheit(celsius): # Call the function and get the Fahrenheit value fahrenheit = celsius_to_fahrenheit(celsius) -# Display the result -print(f"{celsius}°C is equal to {fahrenheit}°F.") -# Program that converts Celsius to Fahrenheit + # Display the result + print(f"{celsius}°C is equal to {fahrenheit}°F.") diff --git a/solutions/tests/test_temperature_converter.py b/solutions/tests/test_temperature_converter.py index 48c43a98c..795c410f7 100644 --- a/solutions/tests/test_temperature_converter.py +++ b/solutions/tests/test_temperature_converter.py @@ -1,6 +1,6 @@ import unittest -from ..temperature_converter import celsius_to_fahrenheit +from solutions.temperature_converter import celsius_to_fahrenheit class TestConverter(unittest.TestCase):