Friend finder

From Computer Science Wiki
Jump to: navigation, search
This a problem set for you to work through [1]

This is a problem set. Some of these are easy, others are far more difficult. The purpose of these problems sets are:

  1. to build your skill applying computational thinking to a problem
  2. to assess your knowledge and skills of different programming practices

What is this problem set trying to do

This problem set is helping you learn pseudocode and think computationally.

The Problem

  1. A one dimensional array exists with the interests. The interests are stored in an array.
  2. A two dimension array exists with a userid and the interests associated with that userid.
  3. In the code sample below, we can see that user id 1 is interested in 2,5,3, and 4. User id 2 is interested in 6 and 7.
  4. We make an assumption that if two people are interested in the same thing, they might have a higher chance of becoming friends than if they didn't share interests.
interests = ["basketball","dancing","video games","crafts","music","eating","cooking","hanging out","football"]
people_and_their_interests = [[1,[2,5,3,4]],[2,[6,7]],[3,[8,0,2]],[4,[3,7,8]],[5,[7,4,8]],[6,[3,5,7,8]]]
  1. ConstructDevelop information in a diagrammatic or logical form. a python algorithm which will find friend matches based on similar interest.

Unit Tests

  • Input: the arrays interests and people_and_their_interests
  • Expected output:
  1. user 1 could be friends with user(s): 3,6
  2. user 2 could be friends with user(s): 4,5,6
  3. user 3 could be friends with user(s): 4,5,6
  4. (etc) for all the users

Hacker Version

Please add output which shows interests and userid. For example,

  • basketball: 3
  • dancing:
  • video games: 1,3
  • crafts: 1,4,6
  • (etc...)


How you will be assessed

Your solution will be graded using the following axis:


Scope

  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. does your code implement the features required by our specification?
  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. is there evidence of effort?

Correctness

  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. did your code meet specifications?
  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. did your code meet unit tests?
  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. is your code free of bugs?

DesignProduce a plan, simulation or model.

  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. is your code written well (i.e. clearly, efficiently, elegantly, and/or logically)?
  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. is your code eliminating repetition?
  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. is your code using functions appropriately?

Style

  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. is your code readable?
  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. is your code commented?
  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. are your variables well named?
  • To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. do you adhere to style guide?

References

A possible solution

Click the expand link to see one possible solution, but NOT before you have tried and failed!


</syntaxhighlight>