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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started