Python tutorials

Building a Todo App with Flask in Python

Introduction In this tutorial, we are going to build an API, or a web service, for a todo app. The API service will be implemented using a REST-based architecture. Our app will have the following main features: Create an item in the todo list Read the complete todo list Update the items with status as “Not Started”, “In Progress”, or “Complete” Delete the items from the list What is REST? REST, or REpresentational State Transfer, is an architectural style for […]

Read more

Run-Length Encoding

In this article we’ll go over how the run-length encoding algorithm works, what it’s used for, and how to implement its encode and decode functions in Python. Run-length encoding (RLE) is a very simple form of data compression in which a stream of data is given as the input (i.e. “AAABBCCCC”) and the output is a sequence of counts of consecutive data values in a row (i.e. “3A2B4C”). This type of data compression is lossless, meaning that when decompressed, all […]

Read more

Introduction to OpenCV with Python

Introduction In this tutorial, we are going to learn how to use OpenCV library in Python. OpenCV is an open source library which is supported by multiple platforms including Windows, Linux, and MacOS, and is available for use in multiple other languages as well; however, it is most commonly used in Python for Machine Learning applications, specifically in the Computer Vision domain. Apart from its cross-platform support and availability in multiple other computer languages, which allows applications developed in it […]

Read more

Text Generation with Python and TensorFlow/Keras

Introduction Are you interested in using a neural network to generate text? TensorFlow and Keras can be used for some amazing applications of natural language processing techniques, including the generation of text. In this tutorial, we’ll cover the theory behind text generation using a Recurrent Neural Networks, specifically a Long Short-Term Memory Network, implement this network in Python, and use it to generate some text. Defining Terms To begin with, let’s start by defining our terms. It may prove difficult […]

Read more

Python for NLP: Creating a Rule-Based Chatbot

This is the 12th article in my series of articles on Python for NLP. In the previous article, I briefly explained the different functionalities of the Python’s Gensim library. Until now, in this series, we have covered almost all of the most commonly used NLP libraries such as NLTK, SpaCy, Gensim, StanfordCoreNLP, Pattern, TextBlob, etc. In this article, we are not going to explore any NLP library. Rather, we will develop a very simple rule-based chatbot capable of answering user […]

Read more

Introduction to GANs with Python and TensorFlow

Introduction Generative models are a family of AI architectures whose aim is to create data samples from scratch. They achieve this by capturing the data distributions of the type of things we want to generate. These kind of models are being heavily researched, and there is a huge amount of hype around them. Just look at the chart that shows the numbers of papers published in the field over the past few years: Since 2014, when the first paper on […]

Read more

Python for NLP: Creating Bag of Words Model from Scratch

This is the 13th article in my series of articles on Python for NLP. In the previous article, we saw how to create a simple rule-based chatbot that uses cosine similarity between the TF-IDF vectors of the words in the corpus and the user input, to generate a response. The TF-IDF model was basically used to convert word to numbers. In this article, we will study another very useful model that converts text to numbers i.e. the Bag of Words […]

Read more

The Python Help System

When writing and running your Python programs, you may get stuck and need to get help. You may need to know the meaning of certain modules, classes, functions, keywords, etc. The good news is that Python comes with an built-in help system. This means that you don’t have to seek help outside of Python itself. In this article, you will learn how to use the built-in Python help system. Python help() function This function helps us to get the documentation […]

Read more

The Python Assert Statement

In this article, we’ll examine how to use the assert statement in Python. In Python, the assert statement is used to validate whether or not a condition is true, using the syntax: assert If the condition evaluates to True, the program continues executing as if nothing out of the ordinary happened. However, if the condition evaluates to False, the program terminates with an AssertionError. >>> assert True Nothing happens when the code above is executed, since the condition evaluates to […]

Read more

Python: Print without Newline

In this article, we’ll examine how to print a string without a newline character using Python. In Python, the built-in print function is used to print content to the standard output, which is usually the console. By default, the print function adds a newline character at the end of the printed content, so the next output by the program occurs on the next line. Try running this code to see an example: print(‘Banana’) print(‘pudding.’) Output: Banana pudding. As expected, the […]

Read more
1 156 157 158 159 160 181