There is an immense amount to be learned simply by tinkering with things. - Henry Ford
Let's be honest: 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're going to 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).
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.
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!
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!
Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.
"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H
"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B
"This is now my favourite first Python go-to reference." - Anthony L
"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S