Python generators explained through 4Ws

Mountains
Photo by Dani Aláez on Unsplash

Today, “what are Generators in Python” and “what are Generators used for in Python” are some of the most popular Python interview questions.

Often, Generator is considered as one of the slightly more intermediate concepts in Python. If you are new to learning Python, you may not have come across…

A better alternative to dictionaries and named tuples in Python

Boat stranded on shore
Photo by Daniel Ian on Unsplash

It is common for us to work with simple data structures such as a Tuple (tuple) or a Dictionary (dict) in Python. We use them almost everywhere and every day in our lives programmers to store data.

For instance, we can represent a car object with the code example below:

Learn the magic behind “with” statements in Python with examples

Mountains
Photo by Aaron Lee on Unsplash

Regarded as an obscure feature by some, the with statement in Python is often only used when dealing with file operations. Below is an example that shows you how to read and write a file with Python’s built-in open function:

A simple example of opening a file in Python.

For…

Four common error-handling mistakes to avoid in Python

Room #404
Photo by Romson Preechawit on Unsplash.

Imagine you are building a blogging app. In the normal flow of your blogging app, users are able to sign up and create blog posts.

An exception (error) is said to occur when the normal flow of your app is interrupted unexpectedly. …

You might have been using them all wrong

A sequence of dominoes
Photo by Bradyn Trollip on Unsplash.

In Python, there are four built-in data types that we can use to store collections of data. With different qualities and characteristics, these built-in data types are known as List (list), Tuple (tuple), Set (set), and Dictionary (dict).

In this article, we are going to slightly dig into the rabbit…

Things you need to know about Python’s formatted string literals (f-string)

Glasses with Code Behind
Photo by Kevin Ku on Unsplash

Long gone are the days when Python developers used the % operator to perform string formatting in Python.

Sometime later down the road when Python 3.0 was introduced, common use of the % the operator was gradually replaced with calling the .format() method on the String object.

Fast forward to…

Why understanding the basics of Transmission Control Protocol (TCP) will make you a better developer

Network Cables
Photo by Jordan Harrison on Unsplash

I vividly remember during my first job interview as a developer, I was asked a couple of programming-related questions, which I had little to no problem answering.

However, things immediately went south when I was asked the question:

“Walk me through what happens when I browse for https://www.google.com

Become a better Django developer with these tips

Pro Django book on desk
Photo by Faisal on Unsplash.

Django is one of the most popular frameworks among Python developers worldwide, with many high-profile sites built on it such as Instagram, Pinterest, Mozilla, and more.

While there a lot of awesome tutorials available out there for one to learn to become a better Django developer, most of them are…

3 Tips for writing clean code with Python examples

Plant on table
Photo by Sarah Dorweiler on Unsplash.

What exactly is “clean code”? While there are many definitions out there, the most popular one that most people agree on is that “Clean code is code that is easy to understand and easy to change or maintain.”

As code is more often read than written, constantly reminding ourselves to…

Ways to Build Applications Fast With No-Code or Low-Code Tools

Turn Ideas Into Reality
Photo by Mika Baumeister on Unsplash

So, what do “no-code” or “low-code” mean? In essence, they mean building software or applications by writing little to no amount of code. Before this, applications are traditionally built by developers or programmers writing code where coding is a difficult skill to master.

Not going to lie…

As a software…

Jerry Ng

Software engineer, writer, FI/RE advocate. I talk about software engineering, finance, and investing. Find me at jerrynsh.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store