Python tutorials

Coroutines in Python

Introduction Every programmer is acquainted with functions – sequences of instructions grouped together as a single unit in order to perform predetermined tasks. They admit a single entry point, are capable of accepting arguments, may or may not have a return value, and can be called at any moment during a program’s execution – including by other functions and themselves. When a program calls a function its current execution context is saved before passing control over to the function and […]

Read more

Understanding OpenGL through Python

Introduction Following this article by Muhammad Junaid Khalid, where basic OpenGL concepts and setup was explained, now we’ll be looking at how to make more complex objects and how to animate them. OpenGL is very old, and you won’t find many tutorials online on how to properly use it and understand it because all the top dogs are already knee-deep in new technologies. To understand modern OpenGL code, you have to first understand the ancient concepts that were written on […]

Read more

Advanced OpenGL in Python with PyGame and PyOpenGL

Introduction Following the previous article, Understanding OpenGL through Python where we’ve set the foundation for further learning, we can jump into OpenGL using PyGame and PyOpenGL. PyOpenGL is the standardized library used as a bridge between Python and the OpenGL APIs, and PyGame is a standardized library used for making games in Python. It offers built-in handy graphical and audio libraries and we’ll be using it to render the result more easily at the end of the article. As mentioned […]

Read more

Quicksort in Python

Introduction Quicksort is a popular sorting algorithm and is often used, right alongside Merge Sort. It’s a good example of an efficient sorting algorithm, with an average complexity of O(nlogn). Part of its popularity also derives from the ease of implementation. We will use simple integers in the first part of this article, but we’ll give an example of how to change this algorithm to sort objects of a custom class. Quicksort is a representative of three types of sorting […]

Read more

Using cURL in Python with PycURL

Introduction In this tutorial, we are going to learn how to use PycURL, which is an interface to the cURL library in Python. cURL is a tool used for transferring data to and from a server and for making various types of data requests. PycURL is great for testing REST APIs, downloading files, and so on. Some developers prefer using Postman for testing APIs but PycURL is another suitable option to do so as it supports multiple protocols like FILE, […]

Read more

Dimensionality Reduction in Python with Scikit-Learn

Introduction In machine learning, the performance of a model only benefits from more features up until a certain point. The more features are fed into a model, the more the dimensionality of the data increases. As the dimensionality increases, overfitting becomes more likely. There are multiple techniques that can be used to fight overfitting, but dimensionality reduction is one of the most effective techniques. Dimensionality reduction selects the most important components of the feature space, preserving them and dropping the […]

Read more

Insertion Sort in Python

Introduction If you’re majoring in Computer Science, Insertion Sort is most likely one of the first sorting algorithms you have heard of. It is intuitive and easy to implement, but it’s very slow on large arrays and is almost never used to sort them. Insertion sort is often illustrated by comparing it to sorting a hand of cards while playing rummy. For those of you unfamiliar with the game, most players want the cards in their hand sorted in ascending […]

Read more

Unit Testing in Python with Unittest

Introduction In almost all fields, products are thoroughly tested before being released to the market to ensure its quality and that it works as intended. Medicine, cosmetic products, vehicles, phones, laptops are all tested to ensure that they uphold a certain level of quality that was promised to the consumer. Given the influence and reach of software in our daily lives, it is important that we test our software thoroughly before releasing it to our users to avoid issues coming […]

Read more

Tensorflow 2.0: Solving Classification and Regression Problems

After much hype, Google finally released TensorFlow 2.0 which is the latest version of Google’s flagship deep learning platform. A lot of long-awaited features have been introduced in TensorFlow 2.0. This article very briefly covers how you can develop simple classification and regression models using TensorFlow 2.0. Classification with Tensorflow 2.0 If you have ever worked with Keras library, you are in for a treat. TensorFlow 2.0 now uses Keras API as its default library for training classification and regression […]

Read more

List Comprehensions in Python

A list is one of the fundamental data types in Python. Every time you come across a variable name that’s followed by a square bracket [], or a list constructor, it is a list capable of containing multiple items, making it a compound data type. Similarly, it is also a breeze to declare a new list and subsequently add one or more items to it. Let us create a new populated list, for example: >>> new_list = [1, 2, 3, […]

Read more
1 146 147 148 149 150 166