The coding articles collection contains curated stories, tips, questions and answers on a wide variety of topics. The main focus of these articles revolves around the languages and technologies presented in snippets, as well as career advice and lessons.
Here are two quick and elegant ways to check if a string is empty in Python.
Mutable default arguments can trip up Python beginners and veterans alike. Here's a quick workaround to deal with them.
It's generally not a good idea to use bare
except clause in Python, but do you know why?
When working with files in Python, it's important to ensure that the file is closed correctly. Here are a couple of ways to do that.
Oftentimes you might need to trim whitespace from a string in Python. Learn of three different way to do this in this short guide.
Python's f-strings can do a lot more than you might expect. Learn a few useful tips and tricks in this quick guide.
A very common problem when working with Python is having to remember the correct version. Luckily, there's an easy fix for that.
Learn 3 easy ways to swap the values of two variables in Python.
Python provides two distinct comparison operators for different task. Stop mixing them up using this quick guide.
Learn two ways to format a string in Python with this quick tip.
Understand Python's named tuples and start using them in your projects today.
Learn the difference between two common ways to access values in Python dictionaries and level up your code today.
Learn the difference between Python's built-in list sorting methods and when one is preferred over the other.
Learn of the two different way to convert a string to lowercase in Python and understand when you should use each one with this quick guide.
Learn everything you need to know about Python's slice assignment with this handy guide.