python-discord / summer-code-jam-2020-qualifier Goto Github PK
View Code? Open in Web Editor NEWQualify for the PyDis Summer Code Jam 2020 by completing the task in this repository.
License: MIT License
Qualify for the PyDis Summer Code Jam 2020 by completing the task in this repository.
License: MIT License
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.
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)
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?
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}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.