Question: Create a function convTemp, which converts temperature from one of the units Fahrenheit, Celsius and Kelvin, to another from this list. Your function should have

Create a function convTemp, which converts temperature from one of the units Fahrenheit, Celsius and Kelvin, to another from this list. Your function should
have 3 input parameters:
x- which can be either a number (int or float), or array
fro - which is a character parameter, having possible values "C"(default),"F", or "K"(Note: from is a reserved word in Python, so we use fro for our
input parameter)
to - which is a character parameter, having possible values "F"(default),"C", or "K"
Use the following relations between different units, with F in Fahrenheits, C in Celsius and K in Kelvin:
F=95*C+32
K=C+273.15
If from and to happen to be the same units (i.e. the same character variables from the set "C,"F""K"}), then your function should return the same vector
as the input vector, but should previously print out the warning, which warns a user that these two are the same (so the function is not useful in that case).
Import the module warnings and use the following command for printing the warning message (do not change this command, not even a single character!)
warnings.warn("Your 'fro' parameter is the same as your 'to' parameter!")
Here are some examples with various inputs and what your function should return. Keep in mind the output vector should be of the same length as the input
vector x. Also, if you don't specify the values of from or to, the default values should be used.
In ]:
 Create a function convTemp, which converts temperature from one of the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!