Login Register






Unit Test filter_list
Author
Message
RE: Unit Test #7
You have to:
1. Look for the user input in the lexicon values
2. Put every tupel of the lexicon in a list that has a value that fits to the user input
3. Return the list of tupels

How to do this:
1.
One possibility to iterate through a dictionary is this:

Code:
for key, value in lexicon.iteritems():

Within this loop you check if value fits to the user input. I.e. if you called scan("bear") you have to check if value == 'bear'.

2.
If value == 'bear', you add the tupel to a list, which will contain all your results:

Code:
tupel = (key, value) list.append(tupel)

3.
Return your list of tupels and you are done
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply





Messages In This Thread
Unit Test - by Pain - 11-26-2012, 05:51 AM