Giter Site home page Giter Site logo

quiz's Introduction

Open an issue on the repository that answers the following questions:

  • Which of the following five Python scripts have been derived from the same source?
  • Which files should include an acknowledgement?
  • What form should an acknowledgement take? Provide an example.

Justify your answers.

quiz's People

Contributors

jarrah42 avatar

Watchers

James Cloos avatar  avatar

quiz's Issues

quiz

  1. All of them seem to derive from the same source because they use essentially the same coding structure.
  2. Among all the files, I think file1 should include an acknowledgement because it has no comments.
  3. They can include a link for the source code they reference to or the person they collaborated with.

Issue

  1. This code is pretty similar with file4 & file5. All three code use combinations without import the modules. Additionally, file3 and file4 both have return ValueError case and looks same.

  2. If people work with file3 and file4 have discussed, so acknowledgement should be contained in both files.

  3. The acknowledgement should be in the first line of the file. To acknowledge who you have worked with or where you have taken reference.

Question Answer

  1. I think all of the file are from the same source because all the main method and process of all the five files are identical except for some exception capture method and tiny distinction.
  2. all the files should add acknowledge because we don't know who write the code and collaborate with whom.
  3. Acknowledgement should involving changing from the previous version and collaborator's name and the changing date.

Questions in Readme file for Advanced python

  1. file5, file4 and file1 are from the save source.
  2. I think they all should include an acknowledgement, especially file1, since there are almost no documentation.
  3. The acknowledgement should include the original website where the source are from. For example, the acknowledgement could be: this piece of code is derived from http://xxxx.xx/xxx with some modification.

My answer

File 3 and File 4 are very similar.
I’m pretty sure File 2 is my source code, so I know exactly where this came from :)
File 1, 2, and 5 look very similar.

Quiz_xc918

Q1: I think all scripts come from the same source code because the approaches for generating binary string are the same. They first create a list of strings of 1s then replace some with 0s in the for loop. Combination from itertools has been used.

Q2: File 1 & 2 should include some acknowledgement.

Q3: The acknowledgement should include the original source such as author names with cooperators, or reference from who wrote on Quora or Stackoverflow.

I had to prepare for a important interview so that did not attend yesterday's lecture. Found this quiz this morning for updating github infomation. Hope this quiz answer would be accepted.

Danny Vilela (dov205

Which of the following five Python scripts have been derived from the same source?

Common themes:

  • Iterating over itertools.combinations(): all files.
    • Passing the generator range(n) as the iterable: all files.
  • Data structure of returned value:
    • List: file1.py -- more or less unique.
    • Set: file2.py, file3.py, file4.py, file5.py
  • Input sanitization: file3.py, file4.py
  • Improper input sanitization:
    • file4.py: checking if both parameters n and k are None? A bit silly.

From this, we suspect both file1.py and file3.py to be original.

Which files should include an acknowledgment?

I suspect file2.py, file4.py, and maybe file5.py should include an acknowledgment. Their implementations are very similar to file3.py's and, given how many ways the method could have been written, their edit distances are way too close.

What form should an acknowledgment take? Provide an example.

If, for example, file4.py didn't know how to properly sanitize input, they could have written:

def bits(n=None, k=None):

    # NOTE: I had difficulty sanitizing valid input values, and received some assistance
    # from the code at https://github.com/nyu-cds/quiz/blob/master/file3.py.

    #First, validate the input values    
    # if k or n is not an integer, return error message
    if int(n) != n or int(k) != k:
        raise ValueError("k and n should be integers")

    # if n <= 0, return error message
    if n <= 0:
        raise ValueError("n should not be negative or zero")
        
    # if k < 0, return error message
    if k < 0:
        raise ValueError("k should not be negative")

    res = set() 
    # use combinations to get the positions of "0"
    for tuple in combinations(range(n), k):
        temp = ["1"] * n
        for i in tuple:
            temp[i] = "0"
        res.add("".join(temp))
    return res 

which is a full acknowledgment of (a) issue the user faced and (b) proper credit to the source.

Note: none of these zbits programs are particularly well-done and, at a high level, they are all candidates of deriving from the same source. They all use itertools.combinations, a list of length n of 1's, etc — not particularly unique. A better understanding of source derivatives would be to use timestamps to see commit history relative to one-another.

python-quiz!

1- file3 and file4 seem to be from the same source, since they have very similar structure. File1 and file2 also seem to be from the same source.

2- Acknowledgement is required when some part of another code is used, or modified, or in case of collaboration among people they all need to acknowledge the others.

3- It could be something like "we would like to thank somebody for making his implementation available", or in case collaboration "we would like to thank our colleagues for their help during this work".

quiz_kl1405

Which of the following five Python scripts have been derived from the same source?
A: file4 and file5 seem to have been derived from the same source.

Which files should include an acknowledgment?
A: It looks like file4 and file5 should include an acknowledgment.

What form should an acknowledgment take? Provide an example.
Example: Located on top of the file: Acknowledgment: The code is originally from xxxxxx with some modification.

quiz

From my view, they look quite similar to each other in the terms of the algorithms. But file 3 and file 4 even have almost the same statement of the input and output, I think these two may from the same source and file 1,2,5 are from the same one.
2.
file 1,2 may need to do that and either file 3 or file 4.
3.
file3, 4 and file 5 need "from itertools import combinations" and others may include the statement that the code is modified from XXX's code(s)

Quiz answers - sm6921

  1. File 1 and file2 have been derived from the same source.
  2. File 1 and file2 need to include an acknowledgement to link to its source.
  3. An acknowledgement should be something like 'Code source available at source-link.' or 'Code derived from source-link.'

answers_sx550

  1. It seems that file1, file2 and file5 have been derived from the same source since they are simple and use the same algorithm and look similar. Besides, file3 and file4 are similar since they have 'exception' part.

  2. If these five files are derived from some other source, all of them should include an acknowledgement.

  3. Something like "Derived from xxx's code at github.com/xxx/source_repo."

Quiz (yfc259)

Q1: File 1,2 and 5 might be from the same source. The coding structures are similar. File 3 and 4 might be from the same source since they both validate the input values and don’t import “itertool”.
Q2: If File 5 is using the user-defined function from File 1 and/or File 2, it should include an acknowledgement. Same to File 3 and File 4. If they work together, they should acknowledge another’s efforts.
Q3: Acknowledgement should include where the original code came from (link or author) and what are the modifications you made if possible. For example, in the top of the file, we might include the statement such as “the following code is derived from <author>’s <link> with some modification in functions...."

answer_qc449

  1. File 2 ,4 and 5 looks similar. They have similar code structure (loops) and use similar data structure for storage.
  2. File 2 4 is probably derived from file 5. File 5 has more details explained and probably it is the source.
  3. File 2,4 should say acknowledgment to file 5's contribution in their development and announced the usage of their code is out of commercial.

Issue

  1. This code is pretty similar with file3 & file4. All three code use combinations without import the modules.

  2. If people work with file have discussed with others, so acknowledgement should be contained in this files.

  3. The acknowledgement should be in the first line of the file. To acknowledge who you have worked with or where you have taken reference.

Quiz Answers

  1. I think file3.py and file4.py are derived from the same source because they have very similar structure. They all go through argument check first, then initialize a set, use intertools.combinations to help code. Both of them did not import itertools.
  2. file4.py should include an acknowledgement because file3.py has more detailed comments and better argument check and coding style. file4.py uses keywrod tuple as a variable, which is not a good practice. Hence, author of file4.py seems less experienced.
  3. An acknowledgement should include comments indicating what the source code is or where the source code is.

Issue

1)It looks like all 5 files have minor differences between them though the basic implementation algorithm in them is the same. File 1 uses list while all other files uses set. File 3 and File 4 does additional error check.
2)All of them need acknowledgment.
3)Can include the source file name and explanation of the logic derived from source.

Quiz Answer

  1. File 3 to 5 are possibly derived from the same source. There is slight difference between them since file3 and 4 include a check of inputs.

  2. I think all the three files should include an acknowledgement.

  3. The acknowledgement should indicate what the source code is and whether there is collaboration between them.

quiz_answer

Quiz

  1. I think file2-5 are similar because the logic is the same.
  2. Of the 5 files, file1.py needs an acknowledgement most since it does't have any comments.
  3. The acknowledgement can be taken in format like ''Collaborated with xxxx on the part of xxx" or listing the reference from books or websites is also good.

Answered by jw4339

  • Which of the following five Python scripts have been derived from the same source?

    • file 4 seems derived from file 2 (adding corner cases checking)
    • file 3 seems derived from file 4 (more corner cases checking), that means file 2
    • file 1 and 2 seems independent
    • file 5 seems independent, or maybe derive from file 2
  • Which files should include an acknowledgement?

    • file 3, 4 and 5
  • What form should an acknowledgement take? Provide an example.

    • Provide the link or reference to the original version, e.g. "The idea is inspired from xxx, <a_link_to_the_source>"
    • Or maybe just fork from Git, and Git will automatically track the history

quiz

  1. 1,2,3,4,5 all look similar. They have .add(''.join(string)) and make sets as opposed to lists in the beginning. Although 1 used lists as opposed to sets. They all use the combinations( ) from itertools inside of a for loop and have an inner loop .

  2. all of them could include an acknowledgment.

  3. The acknowledgment should provide a link in the comments of the function as to where the code came from or to whoever they collaborated with.
    For example:

def kbits(n, k):
"""
Parts of the following code from: https://github.com/vinsonlee/hackerrank/blob/master/python/itertools-combinations/itertools-combinations.py
collaborated with: Jane Doe

"""

Quiz Response

  1. Which of the following five Python scripts have been derived from the same source?

I believe file 1 and 2 come from the same source since the logic for both are very similar and the variable names are different but similar (ex: zbit vs kbits).
File 4 and 5 are also very similar since their logic is the same but file 5 has much more complicated variable names and assertions.
To be fair, they all have very similar logic so it’s quite difficult to tell.

  1. Which files should include an acknowledgement?

If files 1,2 and 4, 5 are from the same code, they both should include either their source or who they worked with.

  1. What form should an acknowledgement take? Provide an example.

A good example of an acknowledgement is a comment right at the top. Ex:
‘’’
zbits(a,b):
Params:
#~description of function + params …

Source: XXXX or Collaborated with: XXXX, XXXX
‘’’

quiz_zl

Which of the following five Python scripts have been derived from the same source?
A: 1,2,5 seems comes from the same source, they are similar in the structure, 3,4 are likely from another source.
Which files should include an acknowledgement?
A: 1,2,4 should include more acknowledgement

What form should an acknowledgement take? Provide an example.
A: add some comments like 1 and 3, and possibly give creddit to 1 and 3

quiz_answer

Which of the following five Python scripts have been derived from the same source?
file 1 & file 2 & file 5 are derived from the same source.

Which files should include an acknowledgement?
I think file 1 & file 2 should include an acknowledgement.

What form should an acknowledgement take? Provide an example.
For example, they should add more comments to explain the steps.

ls4408_quiz1

Problem 1,
3,4 are from the same source.
Their structure are almost same, and only some variables names have been changed.
5 might be from same source too, because it only lacks some raising exceptions compared to 3 and 4.

Problem2,
3,4 lack some acknowledgment

Problem3,
If they collaborate , they should include who they worked with.
If they get the code from somewhere else, they should write at the beginning of their file about where did they learn these codes.
Also, 1 should include some comments about the purpose of the function.

quiz

  1. Actually, all the five files seem similar to each other. But file1, file2, file5 are more likely coming from same source. File3 and file4 seem to come from same source because they both add some pre-argument check. the structure of these five files are same.

  2. File1 and file 2 should include an acknowledgement to file5. Because file5 have more comments and explanation to his codes. And file 4 should include an acknowledgement to file3 since file3 has more detail comments about codes and a better argument check.

3.Acknowledgement should be " collaborated with XXX " or " part of codes is referring to XXX "

Quiz answer

Personally, I think there is not enough evidence to tell anyone is derived from others with confidence.

Given the simple task, especially if it's assigned as homework for "itertools" using combinations, any "original" answers will show considerable level of similarity.

Quiz Answer_ hl2514

  1. From my perspective, all five scripts come from the same source code. Because the approach they use for generating binary string is the same. First they created a list of strings with all "1"s and then replaced some values to be "0" in for loop. The iterator they use is combination object in iteration tools.

  2. File 1 and file 2 need to include acknowledge because they look identical to each other.

  3. Acknowledgement should include the website link where the source code come from or mention the collaborators' names.

Issue

  1. This code is pretty similar with file3 & file5. All three code use combinations without import the modules. Additionally, file3 and file4 both have return ValueError case and looks same.

  2. If people work with file3 and file4 have discussed, so acknowledgement should be contained in both files.

  3. The acknowledgement should be in the first line of the file. To acknowledge who you have worked with or where you have taken reference.

Quiz

  1. file1.py & file2.py seem to come from the same source because functions kbits and zbits are almost identical but with different variable names. file5.py also seems similar to these two.
    Similarly, file3.py & file4.py look to be from the same source. They use the same input validation structure.

  2. If two people worked together on this assignment, both files should contain an acknowledgment. If one used the other as a resource, then that person should state where they got the code from.

  3. The acknowledgment should look something like "Collaborated with so and so on this bit of code" or "this function came from this link on the internet".

quiz

Which of the following five Python scripts have been derived from the same source?

  • file1 and file2
  • file3 and file4

Which files should include an acknowledgement?

  • One of file1 and file2 (whichever was published second), and one of file3 and file4 (whichever was publish second). All files should also acknowledge other resources (e.g. StackOverflow) if they were used.

What form should an acknowledgement take? Provide an example.

  • An acknowledgement should include a link to the original code source on Github and mention the author. It should also explain the extent to which the author referred to/borrowed from the source.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.