Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To be done in python 3.0, please comment your code thoroughly. I don't want to copy your work, I want to learn from it. Thank
To be done in python 3.0, please comment your code thoroughly. I don't want to copy your work, I want to learn from it. Thank you!
Here is the starter code
def findMin(alist): ''' Returns the minimum value of a given list of numbers :param alist: a list of numbers; must not be empty! :return: the smallest number in the given list ''' min_i = 0 for i in range(1,len(alist)): a_num = alist[i] min_val = alist[min_i] if (min_val ''' Returns the list containing the minimum value :param alist: a list of lists of numbers; must not be empty! :return: the list in the list of lists with the smallest value ''' min_i = 0 for i in range(len(a_list_of_lists)-1): a_list = a_list_of_lists[min_i] min_list = findMin(a_list_of_lists[min_i]) if (min_list Question 2 (12 points): Purpose: To practice testing and debugging code that someone else wrote. Degree of Difficulty: Moderate In the document a8q2 functions.py you'll find two functions: . findMin Returns the minimum value of a given list of numbers. min_listsO: Returns the list containing the minimum value These functions contain errors. Your task will be to find the errors using testing. Ordinarily. you would simply fix the errors, but in this question, you will explain what the errors are. You will not need to hand in the corrected code. Part of the exercise is figuring out what the code is supposed to do (based on the documentation)! 1 Write white-box and black-box tests for the function findMin). You should do this without Python, either on paper, or in a simple document. Don't worry about implementing your tests or test-driver until you have thought about which tests you want. Make sure you have at least 3 black-box tests. and 3 white-box tests, as a minimum. More tests may be useful. 2. Implement you r test cases in a document named a8a2-testing. py You canusee (as demonstrated in readings 15.2.4) or a list-of-dictionaries to implement your test driver (as demon- strated in class during chapter 15 exercise 3). 3. Run your tests, and copy/paste the console output to a document named a8q2 output.txt. The 4. Try to deduce the problem with the findMin) function from the output of your testing. Then fix the 5. In the document a8q2 output.txt, describe the error(s) you found. and how you fixed it (them). You console output you hand in should come from the program before you try to fix it! error(s) in the function! do not need to write a lot: a sentence or two for each error is all we want. Write your explanation as if you are explaining the error to a colleague of yours who wrote the functions 6. Repeat the above steps for the second function, min_lists) What to Hand In Remember, for this question, you do not need to hand in the fixed code! A document called a8q2 testing.py containing your testing code as described above. . A document called a8q2 output.txt (rtf and pdf formats are also allowable) with the console output of your test driver copy/pasted into it, and the explanations of the errors you found. Question 2 (12 points): Purpose: To practice testing and debugging code that someone else wrote. Degree of Difficulty: Moderate In the document a8q2 functions.py you'll find two functions: . findMin Returns the minimum value of a given list of numbers. min_listsO: Returns the list containing the minimum value These functions contain errors. Your task will be to find the errors using testing. Ordinarily. you would simply fix the errors, but in this question, you will explain what the errors are. You will not need to hand in the corrected code. Part of the exercise is figuring out what the code is supposed to do (based on the documentation)! 1 Write white-box and black-box tests for the function findMin). You should do this without Python, either on paper, or in a simple document. Don't worry about implementing your tests or test-driver until you have thought about which tests you want. Make sure you have at least 3 black-box tests. and 3 white-box tests, as a minimum. More tests may be useful. 2. Implement you r test cases in a document named a8a2-testing. py You canusee (as demonstrated in readings 15.2.4) or a list-of-dictionaries to implement your test driver (as demon- strated in class during chapter 15 exercise 3). 3. Run your tests, and copy/paste the console output to a document named a8q2 output.txt. The 4. Try to deduce the problem with the findMin) function from the output of your testing. Then fix the 5. In the document a8q2 output.txt, describe the error(s) you found. and how you fixed it (them). You console output you hand in should come from the program before you try to fix it! error(s) in the function! do not need to write a lot: a sentence or two for each error is all we want. Write your explanation as if you are explaining the error to a colleague of yours who wrote the functions 6. Repeat the above steps for the second function, min_lists) What to Hand In Remember, for this question, you do not need to hand in the fixed code! A document called a8q2 testing.py containing your testing code as described above. . A document called a8q2 output.txt (rtf and pdf formats are also allowable) with the console output of your test driver copy/pasted into it, and the explanations of the errors you found
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