Determine whether a person has two friends who has friend

Assignment Help Python Programming
Reference no: EM132368887

Question

You would appreciate some feedback as to how to start answering this question. e.g. what should i try to attempt using python thanks.
You have to analyse friendship groups on campus. Individuals have been allocated a number between 0 and the number of people on campus minus one, and their friendships have been recorded as edges between numbered vertices.

Assume friendships are always bi-directional. Cambridge has implemented this graph in a Python-readable format as an adjacency matrix.

Write the function society(graph matrix, person) which determines whether a person has two friends who are also friends with each other.

Input: a nested list graph matrix that represents a graph as an adjacency matrix, that models the friendships at Cambridge; and an integer person, where 0 ≤ person < number of people on campus.

Output: a boolean, True if person has at least two friends who are also friends with each other; otherwise False.

Examples

a) Calling society(cambridge matrix,0) returns True as 1 and 3 are both friends with 0.

b) Calling society(cambridge matrix,2) returns False as 2 is friends with 0 and 4, but 0 and 4 are not friends with each other.

Reference no: EM132368887

Questions Cloud

About available off-the-shelf products : What you discover about available off-the-shelf products, would it have been wiser for the BBC to adopt a collection of these existing products?
Objectives the objective of maximum profits : Why might a business firm pursue other objectives besides the objective of maximum profits? Why is profit maximization, by itself, an inappropriate goal?
Who do you think ultimately pays the tariffs : When the United States puts tariffs on imports, who do you think ultimately pays these tariffs? Is it the foreign companies selling here, American consumers.
Socially responsible business decision making : Why are consumers and the public concerned with ethical and socially responsible business decision making?
Determine whether a person has two friends who has friend : Write the function society(graph matrix, person) which determines whether a person has two friends who are also friends with each other.
How did freed african americans define meaning of freedom : How did freed African Americans define the meaning of freedom for themselves? What obstacles did they face? The response must be typed.
Implementation of turning process for brittle metals : Project Proposal - Implementation of turning process for brittle metals (metal removal process) - Conduct comprehensive literature review
Identify how a critical access hospital gets paid : What is the primary distinction between prospective payment system reimbursement and how critical access hospitals get paid? Be specific and identify.
What do you conclude from the last of these calculations : Write a program that asks the user to enter the desired value of T and then calculates and prints out the correct altitude in meters.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd