Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

correct my code please Use your favorite approach to show the results in sorted format, descending by PageRank score. The entries at the top should

image text in transcribed

image text in transcribedcorrect my code please

Use your favorite approach to show the results in sorted format, descending by PageRank score. The entries at the top should be the entries with highest PageRank. What are the most important elements in the data set? You may show either the complete list or just the top 10. Check your code by comparing your top 10 to mine. Because we are using a randomized algorithm, your results will not agree exactly with mine, but they should be relatively close. If your top 10 list is very different, then you might want to revisit your previous solutions. For Hamilton, my top 10 were: [('hamilton', 166062), ('burr', 99180), ('washington', 92246), ('jefferson', 72450), ('eliza', 51485), ('angelica', 48042), ('madison', 37421), ('lafayette', 34297), ('lee', 33678), ('jAdams', 31121)] For the flights data, my top 10 were: [('LAR', 18043), # London Heathrow ('ATL', 16370), # Atlanta (JFK', 14795), # New York JFK ('FRA', 14156), # Frankfurt ('CDG', 14073), # Charles de Gaulle (Paris) ('LAX', 13199), # Los Angeles ('ORD', 12915), # Chicago O'Hare ('PEK', 12525), # Beijing In [56]: result=[(key, val) for key, val in sorted(dict2.items (), key=lambda item result TypeError Traceback (most recent call last) /var/folders/xk/q641hh195hn4b5mfkl6z6n1c0000gn/T/ipykernel_46162/1059438087.py in ----> 1 result=[(key, val) for key, val in sorted (Dic. items (), key=lambda item:item())] 2 result /var/folders/xk/q641hh195hn4b5mfkl6z6n1c0000gn/T/ipykernel_46162/1059438087.py in (item) 1 result=[(key, val) for key, val in sorted (Dic.items (), key=lambda item:item())] 2 result TypeError: 'tuple' object is not callable

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

Students also viewed these Databases questions

Question

What is the best conclusion for Xbar Chart? UCL A X B C B A LCL

Answered: 1 week ago