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
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.Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
To achieve this task efficiently in Python using the Spyder IDE well write a function converttemperature that takes two parameters temp for the temper... View full answer
Get step-by-step solutions from verified subject matter experts
