We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7bf6fde commit bc41179Copy full SHA for bc41179
Chapter 6/problems/Problem6_29.py
@@ -0,0 +1,16 @@
1
+def networks(nstudents,listuple):
2
+ dic = {}
3
+ ngroups = 0
4
+ for tupla in listuple:
5
+ if len(dic) < 1:
6
+ dic[ngroups] = set(tupla)
7
+ elif len(dic) >= 1:
8
+ if tupla in dic[ngroups]:
9
+ for number in tupla:
10
+ if number not in dic[ngroups]:
11
+ dic[ngroups].add(number)
12
+ else:
13
+ ngroups += 1
14
15
+ for i in range(len(dic)):
16
+ print('Social network {} is {}'.format(i, dic[i]))
0 commit comments