[docs] Request for assistance in testing

Tebogo Mokwena trmokwena at gmail.com
Wed Apr 4 21:58:05 CEST 2012

 Hi, I'm Tebogo from South Africa and I kindly request your assistance with
the following python programs. In the first program, I am supposed to give
the output and to also state what the program does:

def mystery(a,b):
           if a>b or a<=0:
                     print("Can't run mystery with these values!")
           for i in range(a,b+1):
                  count = 0
                  for j in range(1,i+1):
                      if i%j ==0:
                            count = count + 1
                  if count%2 != 0:

mystery(15, 20)
mystery(15, 10)

For the following program (below) , I was asked to:

   - What is an* equivalent class?*

   Provide a minimal set of test values to support *statement coverage *testing
   of this function                                             [1 mark]

   If we use an exhaustive testing method, we will find that there are *2
   errors* in this program. Explain what they are; whether each is a *syntax
   error or logic error*; and *how to fix* each


   What does the search function
   [1 mark]

def search(word):

            the_list = [ 'i', 'love', 'computer', 'science' ]

            position = 1

            while the_list[position] != word and position<len(the_list):

                    position = position + 1

                    print (position)

You have no idea how much I would appreciate your assistance

With great thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20120404/56724799/attachment.html>

More information about the docs mailing list