Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3 HELP!!! a5q1_functions.py: def findMin(alist): ''' Returns the minimum value of a given list of numbers :param alist: a list of numbers; must not

Python 3 HELP!!!

image text in transcribed

a5q1_functions.py:

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(len(alist)-1): min_val = alist[min_i] a_num = alist[i] if min_val > a_num: min_i = i result = alist[min_i] return result def min_lists(a_list_of_lists): ''' 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): min_list = findMin(a_list_of_lists[min_i]) a_list = a_list_of_lists[min_i] if min_list > a_list[0]: min_i = i result = a_list_of_lists[min_i] return result 
Purpose: To practice testing and debugging code that someone else wrote Degree of Difficulty Moderate In the document a5q1 functions.py you'll find two functions findMin(): Returns the smallest value of a given list of numbers min lists(): Returns the list containing the smallest 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 0. 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 your test cases in a document named a5q1 testing.py. This can be done using the techniques given in the textbook (Chapter 15), or as demonstrated in a Lab 3. Run your tests, and copy/paste the console output to a document named a5q1 output.txt. The console output you hand in should come from the program before you try to fix it! 4. Try to deduce the problem with the findMin 0 function from the output of your testing. Then fix the error in the function! 5. In the document a5q1 output.txt, describe the error(s) you found, and how you fixed it (them). You 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 a5q1 testing.py containing your testing code as described above. A document called a5q1 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

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_2

Step: 3

blur-text-image_3

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

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions