How to get the UTC Timestamp in Python
All dates in your server applications should be stored in the UTC timezone. This is because you always want to store time without the offset… Read More »How to get the UTC Timestamp in Python
All dates in your server applications should be stored in the UTC timezone. This is because you always want to store time without the offset… Read More »How to get the UTC Timestamp in Python
The requests module for Python is very useful in helping simplify HTTP/s requests from Python, but how would you use it in an AWS Lambda… Read More »How to make an HTTP Request in AWS Lambda using Python
The problem Given an array of strings arr. String s is a concatenation of a sub-sequence of arr which have unique characters. Return the maximum possible length of s. Example test-cases Example 1: Input:… Read More »Get the Maximum Length of a Concatenated String with Unique Characters in Python
Let’s say that you have a Python list with the following 5 foods: How do we go about getting the last item? Option 1 It’s… Read More »How to get the last element of a list in Python
This is not the first time that I created a Python3 application that spat out some output and required access to it via an HTTP… Read More »How to embed a web server in your Python3 app
Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond the length of the… Read More »How to duplicate zeros in place using Python
Python has never been the best at doing multiple things at the same time. While there are ways to mostly resolve this, such as using… Read More »A Quick Introduction to Asyncio in Python3
Let’s say that you have an array or a list, or logs. Each of these logs is a space-delimited string of words. For example: logs… Read More »How to Reorder Data in Log Files using Python
A common programming interview question, and for a change, one that you will actually be able to use in the job, is that of implementing… Read More »How to implement a Queue using Stacks in Python
The question Take a string S of lowercase letters. These letters form consecutive groupings of like characters. Find groups with 3 or more like characters… Read More »Find positions of largest groups of characters in a String with Python
Google Colab is a fantastic environment to write Python code using Jupyter Notebooks, hosted for free by Google. If you’ve ever used Jupyter Notebooks before,… Read More »How to Measure Execution Time in Google Colab
A User-Agent is a bunch of text that is sent with every HTTP and HTTPS request. The server processing this request is able to determine… Read More »How to fake a User Agent in Python
Using Operating System Commands in Python Use the Linux/Mac tail command to provide the data: Creating a Python Only Script Read the whole file into… Read More »Read the bottom n lines of a file in Python
As Python developers, we’ve all used pip to install applications, but speaking to other Python developers, it’s not always clear how to make your own… Read More »How to make a Python script Pip-installable
Sending emails using Python and AWS’ SES service is really easy. They provide an SMTP server that you can authenticate against and send email programmatically… Read More »How to send emails using Python and AWS SES SMTP
Sometimes you may need to read the top n lines of a file using Python. We start by opening the file for reading and then… Read More »Read the top n lines of a file in Python
I operate a bunch of different sites and have done for many years now. Some of them get quite a lot of traffic and require… Read More »How Fast is your Website?
Learning Go or Golang as a Python developer, programmer or software engineer is easier than you think. While there are quite a lot of things… Read More »Learn Golang as a Python Developer
Let’s say that you have two dates: How would you create a function that would return the number of days between these two dates? Introducing… Read More »Get the Amount of Days Between Two Dates in Python
Given a directory that contains: We can create a runme.sh file to always make sure we are running python 3. Create a shell script Create… Read More »How to Always run Python 3 from Bash
Given that we are in a leap year this year (2020), it would be nice to know how to programmatically calculate this. Luckily, this is… Read More »How to tell if a year is a Leap Year in Python
It’s important to know about data types and one that comes up fairly regularly is that of Linked Lists. Let’s write the following base code… Read More »How to Reverse a Linked List in Python
In this tutorial, we will create a Python application that can be installed directly from pip that will show the 10 latest blog posts from… Read More »How to package a Python app (pip) for PyPi
This occasionally comes up during coding interviews and is actually quite a decent way to test someone’s aptitude of moving back and forth on a… Read More »How to find the longest Palindrome in a String using Python
Let’s say that you have a binary tree and we needed to know it’s maximum depth. Binary tree input data [3,9,20,null,null,15,7] could be visualised as follows:… Read More »How to get the Maximum Depth of a Binary Tree in Python