Using Python (Spyder), Write a function convert_temperature that takes two arguments: a float parameter temp, the temperature
Fantastic news! We've Found the answer you've been seeking!
Question:
Using Python (Spyder),
Write a function convert_temperature that takes two arguments: a float parameter temp, the temperature to convert; and a str parameter conversion that determines which conversion to perform. Assume that conversion can take two possible values, 'celsius_to_fahrenheit' and 'fahrenheit_to_celsius', and make 'celsius_to_fahrenheit' the default value. Have your function print out a sentence explaining the conversion done, such as “0 °C converts to 32 °F”, and have the function return the converted value.
Your submission should include the function definition of followed by printing the result of three function calls: one that uses the default conversion type, and two that explicitly specify the conversion type, one for each possible conversion (Celsius to Fahrenheit and vice versa). You may (but are not required to) query the user for the input temperatures.
Related Book For
Posted Date: