This challenge write-up first appeared on PyBites.
There is an immense amount to be learned simply by tinkering with things. - Henry Ford
Hey Pythonistas,
Let's be honest here: we slacked off a bit on our blog code challenges! Apart from the increased workload overall, our synchronous approach of solving a challenge before launching a next one, is holding us back.
So we are going to change our approach a bit. We keep launching PyBites Code Challenges (PCCs) on our blog, because most importantly this is what gets YOU to write Python code!
However we are dropping hard deadlines and review posts. Solving them is an ongoing thread and you can see merged solutions on the community branch (each challenge # has a dedicated folder).
You can collaborate with each other on our Slack (= dedicated #codechallenge channel). And of course keep PR'ing your code via our platform.
We are still getting a pretty manageable number of PRs to be able to merge them all in ourselves.
However we think it would be really cool to give each PR a bit more of a code check. Hence we also want to make this a community effort.
So if you want to help out merging PRs into our challenges branch, become a moderator. You can volunteer on Slack.
It's a great chance to read other people's code honing your code review skills, and (last but not least!) become a mentor building up great relationships with other Pythonistas. Sounds fair enough?
In this challenge we're asking you to spice up your life with your very own URL Shortener!
We've all seen sites like bit.ly that allow you to shorten a URL into something... well... shorter! It's time to you make your own.
There are roughly four parts to this challenge:
Make a small Django/Flask/Bottle app that receives in a URL.
Using the supplied URL, generate a unique URL with the base of pybit.es. It should be generated keeping uniqueness in mind.
Return the shortened URL.
Bonus: track the visits in a second DB table for stats.
It sounds more complex but breaking it down into these steps should help you tackle the problem more effectively.
Good luck and have fun!
If you have ideas for a future challenge or find any issues, open a GH Issue or reach out via Twitter, Slack or Email.
Last but not least: there is no best solution, only learning more and better Python. Good luck!
At PyBites you get to master Python through Code Challenges:
Subscribe to our blog (sidebar) to periodically get new PyBites Code Challenges (PCCs) and updates in your inbox.
Apart from this blog code challenge we have a growing collection which you can check out on our platform.
Prefer coding bite-sized Python exercises, using effective Test-Driven Learning, and in the comfort of your browser? Try our growing collection of Bites of Py on our platform.
Want to do the #100DaysOfCode but not sure what to work on? Take our course and/or start logging your 100 Days progress using our Progress Grid Feature on our platform (you can also use the Grid to do 100 Bite exercises in 100 days, earning a die hard PyBites Ninja Certificate!)
>>> from pybites import Bob, Julian
Keep Calm and Code in Python!