Python tutorials

Merge Sort in Python

Introduction Merge Sort is one of the most famous sorting algorithms. If you’re studying Computer Science, Merge Sort, alongside Quick Sort is likely the first efficient, general-purpose sorting algorithm you have heard of. It is also a classic example of a divide-and-conquer category of algorithms. Merge Sort The way Merge Sort works is: An initial array is divided into two roughly equal parts. If the array has an odd number of elements, one of those “halves” is by one element […]

Read more

Design Patterns in Python

Introduction Design Patterns are reusable models for solving known and common problems in software architecture. They’re best described as templates for dealing with a certain usual situation. An architect might have a template for designing certain kinds of door-frames which he fits into many of his projects, and a software engineer, or software architect, should know templates for solving frequent programming challenges. A good presentation of a design pattern should include: Name Motivating problem Solution Consequences Equivalent Problems If you […]

Read more

Creational Design Patterns in Python

Overview This is the first article in a short series dedicated to Design Patterns in Python. Creational Design Patterns Creational Design Patterns, as the name implies, deal with the creation of classes or objects. They serve to abstract away the specifics of classes so that we’d be less dependent on their exact implementation, or so that we wouldn’t have to deal with complex construction whenever we need them, or so we’d ensure some special instantiation properties. They’re very useful for […]

Read more

Working with Redis in Python with Django

Introduction Data is increasingly becoming a valuable commodity in the current era of technology and this necessitates the optimization of storage and access to this data. There are quite a few notable solutions for the storage of data, including Relational Database Management Systems (RDBMS) such as MySQL and PostgreSQL, which store data in a structured format using rows and columns and the relationships within the data. Apart from RDBMS, there are key-value stores that store data based on unique keys […]

Read more

How to Get the Current Date and Time in Python

Introduction Logging, saving records to the database, and accessing files are all common tasks a programmer works on. In each of those cases, date and time play an important role in preserving the meaning and integrity of the data. Programmers often need to engage with date and time. In this article we will learn how to get the current date and time using Python’s builtin datetime module. With that module, we can get all relevant data in one object, or […]

Read more

Heap Sort in Python

Introduction Heap Sort is another example of an efficient sorting algorithm. Its main advantage is that it has a great worst-case runtime of O(n*logn) regardless of the input data. As the name suggests, Heap Sort relies heavily on the heap data structure – a common implementation of a Priority Queue. Without a doubt, Heap Sort is one of the simplest sorting algorithms to implement and coupled with the fact that it’s a fairly efficient algorithm compared to other simple implementations, […]

Read more

Introduction to Speech Recognition with Python

Speech recognition, as the name suggests, refers to automatic recognition of human speech. Speech recognition is one of the most important tasks in the domain of human computer interaction. If you have ever interacted with Alexa or have ever ordered Siri to complete a task, you have already experienced the power of speech recognition. Speech recognition has various applications ranging from automatic transcription of speech data (like voicemails) to interacting with robots via speech. In this tutorial, you will see […]

Read more

Deploying Django Applications to AWS EC2 with Docker

Introduction In the fast-paced field of web applications, containerization has become not only common but the preferred mode of packaging and delivering web applications. Containers allow us to package our applications and deploy them anywhere without having to reconfigure or adapt our applications to the deployment platform. At the forefront of containerization is Docker, which is a tool that is used to package and run applications in containers that are platform agnostic. Serverless technology is also flourishing in this era […]

Read more

Convert Strings to Numbers and Numbers to Strings in Python

Introduction Python allows you to convert strings, integers, and floats interchangeably in a few different ways. The simplest way to do this is using the basic str(), int(), and float() functions. On top of this, there are a couple of other ways as well. Before we get in to converting strings to numbers, and converting numbers to strings, let’s first see a bit about how strings and numbers are represented in Python. Note: For simplicity of running and showing these […]

Read more

Variable-Length Arguments in Python with *args and **kwargs

Introduction Some functions have no arguments, others have multiple. There are times we have functions with arguments we don’t know about beforehand. We may have a variable number of arguments because we want to offer a flexible API to other developers or we don’t know the input size. With Python, we can create functions to accept any amount of arguments. In this article, we will look at how we can define and use functions with variable length arguments. These functions […]

Read more
1 145 146 147 148 149 164