Python Arithmetic Operators

Arithmetic operators are syntactical shortcuts to perform basic mathematical operations on numbers. Operator Name Description Example + Addition Calculating the sum of the two operands 3 + 4 == 7 – Subtraction Subtracting the second operand from the first operand 4 – 3 == 1 * Multiplication Multiplying the first with the second operand 3 … Read more

Python Comparison Operators [Blog + Videos]

Comparison operators are applied to comparable objects and they return a Boolean value (True or False). Operator Name Description Example > Greater Than Returns True if the left operand is greater than the right operand 3 > 2 == True < Less Than Returns True if the left operand is smaller than the right operand … Read more

Python In-Place Assignment Operators

In-place assignment operators (also called compound assignment operators) perform an operation in-place on a variable provided as first operand. They overwrite the value of the first operand variable with the result of the operation when performing the operator without assignment. For example, x += 3 is the same as x = x + 3 of … Read more

[Review] Learn to Code by Solving Problems – by Prof. Daniel Zingaro

In this article, I’ll review the book “Learn to Code by Solving Problems: A Python Programming Primer” by Prof. Daniel Zingaro. The book is available here: Amazon NoStarch This is an independent review. I didn’t include any affiliate link, so I won’t get compensated if you decide to purchase the book. Although I know Daniel … Read more

Python In-Place Bitwise Left-Shift Operator

Python’s in-place bitwise left-shift operator x <<= y calculates the left-shift operation x << y, and assigns the result to the first operands variable name x. You can set up the in-place left-shift behavior in your own class by overriding the magic “dunder” method __ilshift__(self, other) in your class definition. The expression x <<= y … Read more

How to Classify Star Wars Lego Images using CNN and Transfer Learning

This tutorial is about training deep learning (DL) models to classify Star Wars Lego images. We use the TensorFlow library to create and compare the image classifiers. Are you looking for interesting deep learning projects that are suitable for beginners? Do not worry, this is not another MNIST image classification tutorial. Instead, we are going … Read more

Python In-Place Bitwise XOR Operator

Python’s in-place bitwise XOR operator x ^= y calcualtes bitwise XOR x ^ y and assigns the result to the first operand x. To set this up for your own class, override the magic “dunder” method __ixor__(self, other) in your class definition. The expression x ^= y is syntactical sugar for the longer-form x = … Read more

[Cheat Sheet] 6 Pillar Machine Learning Algorithms

This machine learning cheat sheet gives you a visual overview of 6 must-know machine learning algorithms (and where to learn more). Linear Regression: train your linear model to predict output values. K-Means Clustering: apply it on unlabeled data to find clusters and patterns in your data. K-Nearest Neighbors: use a similarity metric to find the … Read more

Logistic Regression in Python Scikit-Learn

Logistic regression is a popular algorithm for classification problems (despite its name indicating that it is a “regression” algorithm). It belongs to one of the most important algorithms in the machine learning space. Linear Regression Background Let’s review linear regression. Given the training data, we compute a line that fits this training data so that … Read more

How To Execute System Commands With Python?

[toc] In this article, we will learn numerous ways to execute system commands in Python. ➥ Problem: Given an external command that can run on your operating system, how to call the command using a Python script? ➥ Example: Say you want to ping a remote server using your operating system’s ping command—all from within your Python program. … Read more