Giter Club home page Giter Club logo

summer-code-jam-2020-qualifier's Issues

short_introduction expected not matching real outcome

So I was working on the short_introduction function and somehow I couldn't get it working.

So I started looking in test_qualifier.py and found out that with two qualifications the amount of words don't work with what's expected.

  • In line 55 you want 31 words while the expected string is 28. Using "'I know I'm not stupid,' the man" will work and is longer that 31 characters so you know that the function will return whole words.
  • In line 57 you expect "see anything." to return which is 13 characters long but you want 16 characters. I fixed that by just asking for 13 characters

Extra 'T' in publication_date

Python 3.7.7
Example code shows an extra 'T' in publication_date.

  - <Article title="The emperor's new clothes" author='Hans Christian Andersen' publication_date='1837-04-07T12:15:00'>
  ?                                                                                                         ^
  + <Article title="The emperor's new clothes" author='Hans Christian Andersen' publication_date='1837-04-07 12:15:00'>
  ?                                                                                                         ^

Here's my code:

def __repr__(self):
    return "<Article title=\"{}\" author='{}' publication_date='{}'>"\
            .format(self.title, self.author, self.publication_date)

Difference between test_qualifier.py and docs

The test qualifier source code says:

def test_104_short_introduction(self):
        """short_introduction should truncate at a space/newline to at most n_characters."""
        contents = (
            (self.content, "'But he has nothing", 20),
            ("'I know I'm not stupid,' the man thought,", "'I know I'm not stupid,' the", 31),
            ("'Magnificent,' said the two officials already duped", "'Magnificent,'", 15),
            ("see anything.\nHis whole", "see anything.", 16),
        )

However the Readme says

Blogs often feature a short section of an article on their front page. Write a method called short_introduction that has an int parameter named n_characters. The method should return a short introduction that contains at most n_characters from the start of the article's content. To avoid awkwardly cutting off text in the middle of a word, find and "cut" the text on the last space or newline character within the first n_characters + 1. You may assume there's always at least one space or newline character within the first n_characters + 1.

So the tests produce different results. In the case of

("'I know I'm not stupid,' the man thought,", "'I know I'm not stupid,' the", 31)

The n+ 1 will produce:

'I know I'm not stupid,' the man

So is it n+1 or just n?

wrong example for common_words

the part about counting n most common used word in article example is wrong. there is only 2 "the" in that sentence.

>>> fairytale.most_common_words(5)
{'the': 3, 'he': 2, 'at': 2, 'all': 2, 'people': 2}
>>> fairytale.most_common_words(3)
{'the': 3, 'he': 2, 'at': 2}

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.