Search my blog:

Browse the full archives:

Building a Twitter Bot in Python with Tweepy

Twitter is one of the world’s largest social media companies. It’s an excellent way to drive engagement for both organizations and individuals.

Twitter is somewhat unique in that it relies on periodically posting short snippets of text. Twitter accounts tend to post more frequently, with each post being shorter in nature.

Because of this, Twitter posting is a process that is easily automated. This tutorial will teach you how to biuld a Twitter bot in Python with Tweepy, a Python package that makes it easy to interact with the Twitter API.

Read More

Pandas loc vs. iloc for Accessing Data in Python

Python is widely considered the best programming language for data science.

This is largely because of its rich ecosystem. Python has countless open-source libraries that make it quick and easy to integrate common functionality into your applications.

Pandas is one of these libaries. Known for its tabular data structure the Pandas DataFrame - which is similar to a spreadsheet that you can manipulate in Python - Pandas is the de-facto tool for working tabular data.

In this tutorial, we will get ourselves familiar with two of the widely used functions to select and filter data from Pandas dataframes: loc and iloc.

Read More

How to Compare Objects in Python

In Python, the identity operators ( is and is not) and the equality operators ( == and != ) have a small difference between them. You would have experienced unexpected behavior while using the is or is not operators to compare values. In Python, the is and is not operators are used to check if two objects share the same memory location and the == and != operators are used to compare their values. .

In this tutorial, we will discuss the differences between equality operators and identity operators and when to use them. We will also see what leads to an unexpected behavior when we use the is or is not objects.

Read More

The History of Python Package Managers

Package managers are an integral part of the Python ecosystem.

Without package managers, it would be much harder for developers to use open-source libraries like NumPy or Pandas.

It’s useful to have some context of the orgiin and history of Python package managers. This article will provide a broad summary of the history of Python package managers and the landscape today.

Read More

SyntaxError in Python: How to Handle Invalid Syntax in Python

Syntax errors are the single most common error encountered in programming.

Regardless of the language used, programming experience, or the amount of coffee consumed, all programmers have encountered syntax errors many times.

Syntax problems manifest themselves in Python through the SyntaxError exception. In this tutorial, I will teach you how to handle SyntaxError in Python, including numerous strategies for handling invalid syntax in Python.

Read More

How to Install Anaconda on Windows

It is advisable to use virtual environments while working with Python. A virtual environment is a way to isolate projects into different environments to reduce clashes between dependencies, improve project structure and remove extra packages.

This not only reduces the size of your Python projects but also improves the readability, maintainability and overall durability by ensuring that only the required packages are maintained.

You can manage your packages and create new environments programmatically after installing Python on your system. With that said, many people prefer to simply install Anaconda for Python.

Read More

A Guide to Python Threading

In Python, threading allows you to run different parts of your program concurrently.

Threading can help you simplify the design of your program.

The greatest advantage of threading is that it helps programmers execute their programs faster.

So, if you are an experienced Python programmer and you’re looking for a faster way to execute your programs, you’ve come to the right place.

That is what I will be showing you in this article.

Read More

What is Exploratory Data Analysis?

Exploratory data analysis (EDA) is a critical component of any data scientist’s tool box. EDA involves learning about a data set to make sure you’re using the right predictive tools to analyze it.

Despite their importance, exploratory data analysis principles are seldom taught. They are learned through the course of building many real data science projects.

This tutorial will teach you the basics of exploratory data analysis in Python.

Read More

How to Send Emails With Python

Python is a highly versatile programming language.

It has a diverse ecosystem of open-source libraries that make it easy to build common functionality in a project. Sending emails with Python is one example of such functionality.

Sending emails is extremely useful - it allows you to send bulk emails, send confirmation or verification codes to users, or even automate regular emailing tasks.

This tutorial will teach you how to send emails with Python using SMTP (Simple Mail Transfer Protocol).

Read More

How to Clean Text in Python for Machine Learning Models

Textual data plays a huge role in machine learning. They are also one of the key types of data in addition to numerical data values.

Text is used for various applications in machine learning such as language translation, sentiment analysis, content detection, and even developing chatbots. All these require massive amounts of textual data in order to produce successful results.

As much as textual data is rich in useful content, most of them are highly disorganized, unstructured, and often contain noise. This is why we are required to clean texts before utilizing them to train our machine learning models.

This tutorial will teach you how to clean texth in Python for use in machine learning models.

Read More

How to Write C++ Comments

Writing good comments is one of the most important skill for software developers.

Great commenting requires you to strike a delicate balance. On the one hand, your comments should allow your code to be interpretable by outside users. On the other hand, too many comments can add bloat to your code and ultimately make it harder to understand.

In this tutorial, you’ll learn how you write comments in C++. You’ll learn both the technical aspects of including comments in your code as well as professional guidelines on what types of comments you should include (and avoid).

Read More

A Complete Guide to Python Exceptions

A Python program will terminate as soon as it encounters an error.

These errors can be syntax errors or they can be exceptions. An exception is an event that interrupts the normal flow of your Python program.

This article will teach you how to handle Python exceptions using try and except statements.

Read More

Python vs. JavaScript: The 11 Major Differences

Stack Overflow (a question-answering platform for software professionals and developers) surveys more than 100,000 software developers annually to identify programming trends, job opportunities, and challenges.

In a survey in 2018, they found out that Python was the most popular programming language among the developer community. 25.1% developers wanted to learn it and increase their programming skills. JavaScript ranked second after Python with a 19% popularity rate.

In this article, I explore 11 major differences between the Python and JavaScript programming languages.

Read More

How to Run Python Scripts

Python is one of the most popular programming languages in the world. It is extremely powerful, has easy syntax and plenty of useful libraries that you can use to build projects.

If you’re starting to learn Python, then knowing how to run your Python scripts is an important skill to learn. If you don’t know how to run your scripts, you can’t verify whether they actually work. It is the only way to really test your programs.

In this step-by-step guide, you’ll learn everything you need to know about the basics of running Python scripts. We’ll cover how the techniques used for running scripts differs based on your environment, your operating system, and even your skills as a developer.

Read More

Python 3 Installation & Setup Tutorial

Python is one of the easiest to learn and the most versatile programming languages available.

It is highly popular among data science enthusiasts and researchers.

This tutorial will teach you how to install Python 3 on your computer, including guidance for several different operating systems.

Read More

How to Write Anonymous Functions in JavaScript

There are a number of different ways to write functions in JavaScript.

One of the types of JavaScript functions is called anonymous functions.

As its name suggests, an anonymous function is a function that is declared without a name. Said differently, an anonymous function does not have an identifier. Anonymous functions are usually arguments passed to higher-order functions.

In this tutorial, I will teach you how to write an anonymous function in JavaScript. You will also learn the many uses of anonymous functions and the advantages and disadvantages of using this function type in JavaScript.

Read More

How to Use Python Pointers

Have you ever worked in programming languages like C++ or C?

If yes, you would have definitely come across the term pointers.

Every variable has a corresponding memory location and every memory location has a corresponding address defined for it. Pointers store the address of other variables.

Surprisingly, pointers don't really exist in Python. If that is the case, what am I writing about here?

Everything is an object in Python. In this article, we will look at the object model of Python and see how we can fake pointers in Python.

Read More

Python Pass - Doing Nothing, and Why That's Useful

The Python pass keyword allows you to skip over a block of Python code.

Said differently, it allows you to create a block (whether in a function, loop, or something else) and have that block run with no functionality.

This tutorial will teach you how to use the Python pass statement. Specifically, we will discuss how the Python pass statement is useful during the development stage and how it differs from different flow control keywords in Python.

Read More

Python Speech Recognition - a Step-by-Step Guide

Have you used Shazam, the app that identifies music that is playing around you?

If yes, how often have you wondered about the technology that shapes this application?

How about products like Google Home or Amazon Alexa or your digital assistant Siri?

Many modern IoT products use speech recognition. This both adds creative functionality to the product and improves its accessibility features.

Python supports speech recognition and is compatible with many open-source speech recognition packages.

In this tutorial, I will teach you how to write Python speech recognition applications use an existing speech recognition package available on PyPI. We will also build a simple Guess the Word game using Python speech recognition.

Read More

How to Use JavaScript onclick Events

When writing code in JavaScript, you will often want to execute code when the user interacts with the webpage.

For example, you want to do something when a user clicks a button. You might also want something to happen when a user clicks an image.

How can such functionality be implemented in JavaScript?

You can use the onclick() event, which is a very popular event in JavaScript. It allows you to execute code when a user clicks an element on a webpage (such as a button).

In this article, I will teach you how to use JavaScript onclick events to make your webpages more interactive.

Read More

How to Write a Bubble Sort Algorithm in JavaScript

The bubble sort algorithm is a simple comparison-based sorting algorithm.

In this algorithm, each element in an array is compared to the adjacent element in the array and then swapped, if required, until all the elements of the array are properly sorted.

In this article, you will learn the basics of bubble sort algorithm and how to write a bubble sort algorithm in JavaScript. I will also discuss the time complexity of the bubble sort algorithm.

Read More

How to Create a Beautiful Soup Web Scraper in Python

The internet is brimming with data about any topic you can imagine.

Much of this data exists on websites on public domains that you can access through a web browser. To harness this data, you’ll need to learn the valuable skill of Python web scraping.

This tutorial will teach you about the basics of web scraping by using a practical example. More specifically, we’ll scrape job postings from the PythonJobs website using Python’s BeautifulSoup library.

Read More

Creating a Python GUI using Tkinter

Tkinter is the native Python GUI framework that comes bundled with the standard Python distribution.

There are numerous other Python GUI frameworks. However, Tkinter is the only one that comes bundled by default.

Tkinter has some advantages over other Python GUI frameworks. It is stable and offers cross-platform support. This enables developers to quickly develop python applications using Tkinter that will work on Windows, macOS, and Linux.

Another benefit is that the visual elements created by Tkinter are rendered using the operating system’s native elements. This ensures that the application is rendered as though it belongs to the platform where it is running.

Tkinter is not without its flaws. Python GUIs built using Tkinter appear outdated in comparison to other more modern GUIs. If you’re looking to build attractive applications with a modern look, then Tkinter may not be the best option for you.

On the other hand, Tkinter is lightweight and simple to use. It requires no installation and is less of a headache to run as compared to other GUI frameworks. These properties make Tkinter a solid option for when a robust, cross-platform supporting application is required without worrying about modern aesthetics.

Because of its low aesthetic appeal and easy of use, Tkinter is often used as a learning tool. In this tutorial, you will learn how to build a Python GUI using the Tkinter library.

Read More

Object-Oriented Programming (OOP) in Python

Python inherently an object-oriented programming language, which makes it easy to work with classes and objects in Python.

Object-oriented programming is an example of a programming paradigms, which are a way to distinguish between different programming languages. Languages can belong to multiple paradigms.

In this tutorial, you will learn about object-oriented programming (OOP) in Python. We’ll discuss the broad characteristics of object-oriented programming as well as several examples of how you can implement this paradigm in practice.

Read More

The Python `turtle` Library - A Step-by-Step Tutorial

The Python programming language, like most languages, is purely text-based. This can make it quite boring for young learners.

Visual tools can be important educational resources. More specifically, the turtle library is a great tool to help elementary and middle school students to master the language.

The turtle library comes with a collection of commands that you can use to create artwork and games.

If you’re an elementary or a middle school student with the desire to learn Python (or an educator who is serving that audience), you’ve come to the right place.

This tutorial will help you start your Python programming journey by creating shapes and images using the Python turtle library.

Read More

The 10 Best JavaScript Libraries and Frameworks for 2020 (and Beyond!)

There has never been a better time to be a JavaScript developer.

Not only is there a multitude of frameworks, libraries, and tools available to developers, it's evident that the popularity of web applications is going to grow for a long time.

Add to this the fact that many JavaScript frameworks allow you to build native apps, and it is easy to see why it has become the go-to language for so many developers.

We truly are spoiled for choice with the number of sophisticated frameworks out there, which can make it somewhat difficult to choose one for your project.

In this article, I'll cover the 10 most important JavaScript libraries (with the best listed at the end) to help you make a more informed decision.

Read More

How to Write Java Variables

Java is a robust language and is used to build many programs.

Variables are the building blocks of any language. Variables in Java have a huge role to play in making it a widely accepted language.

What is a variable? A variable can be defined as a name given to a certain memory location, which is a basic unit in a program. All languages use variables to store data and the value of a variable can be changed during the execution of a program. Any operation done on the variable will affect the memory location.

It’s critical that you understand how variables work if you’re learning to become a Java programmer. In this tutorial, you will learn how to write Java variables.

Read More

The 10 Best Java Frameworks for 2020 (and Beyond)

Java is one of the most robust programming languages that has ever existed.

Combined with frameworks, Java can provide excellent solutions for domains like IT, cloud computing, banking, or even e-commerce.

In this article, I will discuss Java frameworks and why it is beneficial to use them. Also, I will briefly discuss the 10 best Java frameworks for building applications in 2020 (and beyond).

Read More

SyntaxError in Python: How to Handle Invalid Syntax in Python

Syntax errors are the single most common error encountered in programming.

Regardless of the language used, programming experience, or the amount of coffee consumed, all programmers have encountered syntax errors many times.

Syntax problems manifest themselves in Python through the SyntaxError exception. In this tutorial, I will teach you how to handle SyntaxError in Python, including numerous strategies for handling invalid syntax in Python.

Read More

How To Write Java Comments The Right Way

Commenting is an integral part of any programming language. Tt is a guide that helps in better understanding the functionality of a program. Good programmers tend to comment as they go while writing the code.

Most of the time, when you write code, you will need to go back and make changes later. Without Java comments, it’s easy to get lost.

This is why I specifically make sure to make comments as I write code. Not only does it help me keep track of the code as it grows more complicated, but it also makes the code more understandable for anyone that needs to reference the code at a later date.

Comments in Java are the statements in the Java code that are not executed when the program is run. Think of them as markers that guide the reader.

Said differently, comments provide information about the code without changing the code’s functionality. Some programmers can also use it to disable certain portions of code during development.

In this tutorial, I will how to write Java comments and what are some of the best ways to use them.

Read More

Python vs. C++: A Comprehensive Comparison

The debate between Python and C++ has been hot in the programming world for as long as anyone can remember.

Both languages have valuable use cases. When it comes to choosing between them, one must be aware of the syntax, usage and overall programming approach of each language.

There are many factors that will weigh on the Python vs. C++ debate. In this article, I will discuss both languages and highlight the key differences between Python and C++ that should make it easy for you to pick the right language for your project.

Read More

How To Write Java Loops

Loops are an important part of any computer application.

Similarly, learning the syntax for writing loops is a crucial step in learning a new programming language. Java is no exception.

In this tutorial, you’ll learn about the different types of loops in Java and how to write loops in the Java programming language.

Read More

How To Handle KeyError Exceptions in Python

KeyError exceptions are a common error encountered by junior Python developers.

Unfortunately, it’s not always clear how to handle these exceptions.

You’ll be glad to hear that handling KeyError messages is likely easier than you think. In this article, I will teach you how to handle KeyError exceptions in Python.

Read More

np.append() - How To Use NumPy Append in Python

The NumPy programming library is considered to be a best-of-breed solution for numerical computing in Python.

NumPy stands out for its array data structure. NumPy arrays are excellent for handling ordered data. Moreover, they allow you to easily perform operations on every element of th array - which would require a loop if you were using a normal Python list.

One of the core capabilities available to NumPy arrays is the append method. In this tutorial, I will explain how to use the NumPy append method to add data to a NumPy array.

Read More

np.reshape - How to Manipulate Arrays Using NumPy's Reshape Function

NumPy is the most popular Python library for numerical and scientific computing.

NumPy’s most important capability is the ability to use NumPy arrays, which is its built-in data structure for dealing with ordered data sets.

The np.reshape function is an import function that allows you to give a NumPy array a new shape without changing the data it contains. In this tutorial, I will teach you how to use the NumPy reshape function to manipulate arrays in NumPy.

Read More

How To Use the Python Square Root Function

There are many situations in which you will want to find the square root of a function in a Python application.

Fortunately, Python includes some very powerful functionality for calculating square roots.

In this article, I will teach you how to use the Python square root function. I will also show you how to calculate square roots without this function, and how to calculate the square root of every element in an outside data structure.

Read More

np.arange() - How To Use the NumPy arange() Method

NumPy is a Python library widely considered to be the most important library for numerical computing.

Within NumPy, the most important data structure is an array type called np.array().

NumPy contains a number of methods that are useful for creating boilerplate arrays that are useful in particular circumstances. One of these methods is np.arange().

In this article, I will teach you everything you need to know about the np.arange() method. By the end of this article, you will know np.arange()’s characteristics, uses, and properties, and will feel comfortable integrating this method into your Python applications.

Read More

How To Write C++ Variables

Variables are an important part of any software application.

However, every programming language has different variable characteristics. Some languages have special syntax.

There is also the question of typing - some languages are statically typed (which means you must specify a variable’s data type before value assignment) while others are dynamically typed (which means a variable can assume any value, with no specification required).

There is much to understand about a language’s variables before starting to write code. With that in mind, this article will teach you how to write C++ variables properly, which will save you time and grief later on in your programming journey.

Read More

The Best PHP Frameworks For 2020 (and Beyond)

PHP has come a long way in the last 25 years. What used to be a relatively under-powered scripting language has now become a powerful tool to build complex applications.

It’s no wonder, then, that PHP is one of the most popular choices for web applications around the world and that a whole slew of PHP frameworks have emerged over the past decade and a half.

In this article, I’ll go over the 10 best PHP frameworks for 2020 and some of their defining features. Use this as a guide to selecting the right framework for your project.

Read More

How To Write Python Classes: Code, Examples, & More

Python is an object-oriented programming (OOP) language.

OOP is methodology used by programmers that enables a system or program to be defined as a set of objects, which can be manipulated and controlled in a piece-by-piece manner.

It is important for you to understand why object oriented languages are necessary in programming. When creating complex code, object-oriented programming allows you to re-use code, making it easy to maintain and scale. It also puts emphasis on objects, unlike procedure oriented programming languages that stress the importance of functions.

In this article, I am going to teach you how to write Python classes - which are special constructs that programmers use to organize related items in an application.

Read More

How To Write Python Comments: The 2020 Guide

For programmers, it is important that your code is easily understood by outside users.

While professionals might not find it difficult to understand, for someone who is trying to learn Python, including comments in the code can be very helpful.

I have seen many bad practices within Python comments over the years.

In this article, I will explain the best way to write Python comments for developers in 2020 (and beyond!).

Read More

How To Write React JSX Comments

Writing detailed comments is an important component of writing software.

However, every language and framework has its own syntax for writing comments. This can make it difficult for developers to know how to write comments when they’re learning a new language or library.

The JavaScript library React has some notoriously bizarre syntax for writing comments. In this article, I’m going to explain how to write comments in React JSX.

This article starts by explaining what React and JSX are; if you’re already familiar with React ecosystem and only want to learn about how to write React JSX comments, click here to skip to the relevant section of this article.

Read More

The Essays of Warren Buffett: Quotes From the Best Investor of All Time

Warren Buffett is unquestionably one of the best investors to have ever lived.

Moreover, he has been very willing to share his writing with the world through his annual shareholder letters.

I have personally learned a great deal from reading Buffett’s writing over time. In this article, I will share a collection of Warren Buffett’s most insightful writings about the art and science of business and investing.

Read More

How to Profile Python Code: Accurately Measure the Performance of your Software

As software engineers, we are paid to create high-quality code that performs.

Performance can be measured in a number of ways: the problems it solves, its uptime, or a slew of quantitative metrics.

Speed is unquestionably an important component of software performance. In this article, I’ll show you how to measure the speed of Python code using a process called “profiling”, step-by-step.

Read More

Coronavirus Tests, Cases, and Deaths by US State

The coronavirus pandemic continues to worsen, both in terms of the actual health impact of patients and the broader effect it has had on our economy and psychology. The purpose of this post is to list some real statistics on the coronavirus - withoutthe sensationalism that we have seen from some major news outlets.

Read More