Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python please Aufo-graded programming assignments masy use a Unit test to test small parts of a program. Unlike a Compare output test, which evaluates

in python please
image text in transcribed
Aufo-graded programming assignments masy use a Unit test to test small parts of a program. Unlike a Compare output test, which evaluates your program's output for specific input values, a Unit test evaluates individual functions to determines if each function. - is named correctly and has the correct parameters and return type - calculates and returns the correct value (or prints the correct output) In Python labs, the line if __name_ = __main_ ': is used to separate the main code from the functions' code so that each function can be unit tested This example lab uses multiple unit tests to test the kilo_to_pounds f function. Complete a program that takes a weight in klograms as input, converts the weight to pounds, and then outputs the weight in pounds. 1 kilogram =2.204 pounds (ibs). Ex: If the input is: 10 the output is: 22.040000000000003lbs Note: Your program must define the function def kilo_to_pounds ( ki los) The program below has an error in the kilo_to pounds() function. 1. Try submitting the program for grading (click 'Submit mode', then "Submit for grading'). Notice that the first two test cases fail, but the third test case passes. The first test case fails because the program outputs the result from the kilo_to pounds 0 function, which has an error. The second test case uses a Unit test to test the kilo. to.pounds 0 function, which falls, 2. Change the kilo_ to pounds 0 function to multiply the variable kilos by 2.204, instead of dividing . The return statement should be: return ( kilos2,204). Submit again. Now the test cases should all pass. Note: A common error is to mistype a function name with the incorrect capitalization. Function names are case sensitive, so if a lab program asks for a kilo-to. pounds:) function, a kilo. To Pounds: function that works for you in develop mode will result in a failed unit test (the unit test will not be able to find kilo_to_pounds 0 ). \begin{tabular}{l|l} LAB \\ ACTiviry & 5.41 : Lab training. Unit tests to evaluate your program \end{tabular} 2/10 main.py Load dofault template

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions

Question

LO2 Distinguish among three types of performance information.

Answered: 1 week ago