Question: slove with python 3 frineds are the numbers for example, 1 is friend with 0,3,4,6,7 2 is friend with 0, 3, 6, 8, 9 100

slove with python 3

frineds are the numbers for example, 1 is friend with 0,3,4,6,7

2 is friend with 0, 3, 6, 8, 9

100 means 1 has two friends 0 and 0

def people_with_most_friends(network): '''(2Dlist)->1D list Given a 2D-list for friendship network, returns a list of people (IDs) who have the most friends in network.''' max_friends=[] # YOUR CODE GOES HERE return max_friends

run:

>>> people_with_most_friends(net1)

[1, 2, 8]

>>> people_with_most_friends(net2)

[0]

>>> people_with_most_friends(net3)

[0]

>>> people_with_most_friends(net4)

[0]

note net1.txt contains: 100 10 20 31 41 61 71 92 32 62 82 93 83 94 64 74 58 96 87 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!