Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task ( Python ) : Implement the function: convert _ units ( celsius _ value, units ) that accepts two arguments, a float ( celsius
Task Python: Implement the function:
convertunitscelsiusvalue, units
that accepts two arguments, a float celsiusvalue and an int units
The function will return the supplied temperature, converted as specified to a float:
If units return temperature in Celsius no change
if units return temperature in Fahrenheit
if units return temperature in Kelvin
Prompt the user for the Celsius temperature and units in main the unittest code. Validate units in convertunits, if the user enters an invalid units value something other than or convertunits must return an error code I recommend that you return None to main and main will tell the user and then end the program. None is a object type in Python that has only one value, None. In the real world, you would also want to check for valid values for celsiusvalue. Don't worry about prompting the user to reenter the units, just tell them to run the program again. When we learn about loops, we will prompt again when invalid input is presented.
Note that convertunits must return a float floating point number or an error code. This float is the result of the conversion done by the convertunits function. Your convertunits function performs the computation based on the arguments passed and the main function will handle all of the inputoutput Remember the main function contains the unittest code. Code to add to: def printheader:
printSTEM Center Temperature Project"
printName
def main:
printheader
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started