Ejemplo n.º 1
0
'''This module should be used to test the parameter and return types of your
functions.  Run this on your a3_functions.py and make sure there are no errors
before submitting.'''

import a3_functions

if __name__ == '__main__':
	
	# Type check a3_functions.load_profiles
	profiles_file = open('profiles.txt')
	person_to_friends = {}
	person_to_networks = {}
	
	result = a3_functions.load_profiles(profiles_file, person_to_friends, 
	person_to_networks)
	assert isinstance(result, type(None)),\
	'''a3_functions.load_profiles should return a None, 
	but returned %s.''' % (type(result))
	
	
	# Type check a3_functions.invert_networks_dict
	person_to_networks = \
	{'Cameron Tucker': ['Clown School', 'Wizard of Oz Fan Club'],
	'Gloria Pritchett': ['Parent Teacher Association']}
	
	result = a3_functions.invert_networks_dict(person_to_networks)
	assert isinstance(result, dict),\
	'''a3_functions.invert_networks_dict should return a 
	dict of {str : list of strs}, but returned %s.''' % (type(result))

	for (key, value) in result.items():	
Ejemplo n.º 2
0
import a3_functions

if __name__ == '__main__':

    # During testing, we may change the values of these variables.
    friendships = {}
    networks = {}
    profiles_file = open('profiles.txt')

    # Add your code here.
    person = 0
    while person != '':
        a3_functions.load_profiles(profiles_file, friendships, networks)
        person = raw_input("Please enter a person(or press return to exit):")
        recommendations = a3_functions.make_recommendations(
            person, friendships, networks)
        if recommendations == [] and person != '':
            print "There are no recommendations for this person."

        else:
            recomlist = a3_functions.sort_recommendations(recommendations)
            for names in recomlist:
                print names

    print "Thank you for using the recommendation system!"
Ejemplo n.º 3
0
import a3_functions
       
if __name__ == '__main__':
    
    # During testing, we may change the values of these variables.
    friendships = {}
    networks = {}
    profiles_file = open('profiles.txt')

    # Add your code here.  
    person = 0
    while person != '':
        a3_functions.load_profiles(profiles_file, friendships, networks)
        person = raw_input("Please enter a person(or press return to exit):")
        recommendations = a3_functions.make_recommendations(person, friendships,networks)
        if recommendations == [] and person != '':
            print "There are no recommendations for this person."
            
        else:
            recomlist = a3_functions.sort_recommendations(recommendations)
            for names in recomlist:
                print names
            
            
 
        
    print "Thank you for using the recommendation system!"