subject

Needed in python! Auto-graded programming assignments may use a Unit test to test small parts of a program. Unlike a Compare output test, which evaluates your program's output for specific user 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)
This example lab uses multiple unit tests to test the kilo_to_pounds() function.
Complete a program that takes a weight in kilograms as input, converts the weight to pounds, and then outputs the weight in pounds. 1 kilogram = 2.204 pounds (lbs).
Ex: If the input is: 10
the output is:
22.040000000000003 lbs
Note: Your program must define the function
def kilo_to_pounds(kilos)
The program below has an error in the kilo_to_pounds() function.
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() function, which has an error. The second test case uses a Unit test to test the kilo_to_pounds() function, which fails.
Change the kilo_to_pounds() function to multiply the variable kilos by 2.204, instead of dividing. The return statement should be: return (kilos * 2.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()).
Code given in zybooks:
def kilo_to_pounds(kilos) {
# This statement intentionally has an error.
return (kilos / 2.204)
if __name__ == '__main__':
kilos = float(input());
pounds = kilo_to_pounds(kilos);
print(pounds, "lbs");

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
What role do chromosomes play in inheritance?
Answers: 1
question
Computers and Technology, 22.06.2019 12:10
Linux is distributed under gnu gpl. why is this important? a. it ensures that only torvalds can profit from the sale of linux b. it prevents unknowledgeable users from downloading programs they don't know how to operate. c. it provides protection for the developers who created linux. d. it states that anyone can copy, modify, and share the program if changes are made public.
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag.e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
You know the right answer?
Needed in python! Auto-graded programming assignments may use a Unit test to test small parts of a...
Questions
Questions on the website: 13722362