Question: slove with python 3 def k_or_more_friends(network, k): '''(2Dlist,int)->int Given a 2D-list for friendship network and non-negative integer k, returns the number of users who have
slove with python 3
def k_or_more_friends(network, k): '''(2Dlist,int)->int Given a 2D-list for friendship network and non-negative integer k, returns the number of users who have at least k friends in the network Precondition: k is non-negative''' # YOUR CODE GOES HERE pass
run:
>>> k_or_more_friends(net1, 5)
3
>>> k_or_more_friends(net2, 8)
1
>>> k_or_more_friends(net3, 12)
0
>>> k_or_more_friends(net4, 70)
33
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
Get step-by-step solutions from verified subject matter experts
