Code Editor
Gaining Insights

Sorting and Outputting the Results

Finally, to view the results, we'll have to sort them and then display the top 5 traits from the sorted results.

These will be the top 5 traits you share with the celebrity you selected for the application.

sorted_result = sorted(compared_results.items(), key=operator.itemgetter(1)) for keys, value in sorted_result[:5]: print keys, print(user[keys]), print ('->'), print (celebrity[keys]), print ('->'), print (compared_results[keys])
Report a Bug
If you see a bug or any other issue with this page, please report it here.