Skip to content

Instantly share code, notes, and snippets.

@stebunovd
Last active September 16, 2020 14:59
Show Gist options
  • Save stebunovd/1348f9f890d98dce68fa60447b1b43fd to your computer and use it in GitHub Desktop.
Save stebunovd/1348f9f890d98dce68fa60447b1b43fd to your computer and use it in GitHub Desktop.
Python code challenges

These are code challenges for the “Python Developer” position at Lexipol. It’s enough to complete only one of them, so choose whichever one you like more.

1. Reddit proxy

Implement a simple proxy server for www.reddit.com that can be run locally on a specified port. It must modify the text content by adding the ™ symbol after any 5-letter word.

For example:

Text extract from an original post: https://www.reddit.com/r/explainlikeimfive/comments/il5ptb/eli5_why_do_humans_need_to_eat_many_different/

In addition to the 'efficiently breaking down grass' thing, and the 'they 
eat a variety of plants' thing, there's also the fact that species typically 
evolve the ability to make vitamins that they can't get easily in their diet. 
For example, humans make vitamin D because there aren't many food sources of 
it, but we can't make vitamin C, but can find it in food. But other species 
can make their own vitamin C.

As seen via your proxy™: http://127.0.0.1:8232/r/explainlikeimfive/comments/il5ptb/eli5_why_do_humans_need_to_eat_many_different/

In addition to the 'efficiently breaking down grass™' thing™, and the 'they 
eat a variety of plants' thing™, there's also the fact that species typically 
evolve the ability to make vitamins that they can't get easily in their™ diet. 
For example, humans make vitamin D because there™ aren't many food sources of 
it, but we can't make vitamin C, but can find it in food. But other™ species 
can make their™ own vitamin C.

Requirements:

  • Python 3.6+
  • All pages™ must function correctly, just like the originals (except for the modified text);
  • All links™ to other™ Reddit pages™ must lead to your proxy™. External links™ must remain unchanged;
  • You can use any open-source libraries that you’d like to;
  • Less code is better, although there’s no strict limit™. Tests™ are welcome;
  • Please follow PEP8.

Please send us your solution as a Github gist or public repo.

2. Ordering feature for DjangoQL

This task could be more complex than the first one, but it is also more practical. Instead of working on an abstract code challenge, you may make a contribution to an open-source project.

Here’s the original issue: ivelum/djangoql#46

Please submit your solution as a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment