Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

6.29 In your class, many students are friends. Let's assume that two students sharing a friend must be friends themselves; in other words, if students

image text in transcribed
6.29 In your class, many students are friends. Let's assume that two students sharing a friend must be friends themselves; in other words, if students O and 1 are friends and students 1 and 2 are friends, then students 0 and 2 must be friends. Using this rule, we can partition the students into circles of friends. To do this, implement a function networks() that takes two input arguments. The first is the number n of students in the class. We assume students are identified using integers 0 through n 1. The second input argument is a list of tuple objects that define friends. For example, tuple (0; 2) defines students O and 2 as friends. Function networks() should print the partition of students into circles of friends as illustrated: >>> networks(5, [(0, 1), (1, 2), (3, 4)]) Social network O is (0, 1, 2) Social network 1 is (3, 4)

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

Step: 3

blur-text-image

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

Describe Balor method and give the chemical reaction.

Answered: 1 week ago

Question

How to prepare washing soda from common salt?

Answered: 1 week ago

Question

=+Understand the fi eld of comparative IHRM.

Answered: 1 week ago

Question

=+j Understand different types of regions in the world.

Answered: 1 week ago