Introduction To Machine Learning And Its Applications

Machine learning is one of the fastest-growing technologies and it is going to play a pivotal role in the future of technology. With the help of various algorithms machine learning is used to build mathematical models that have the capability to make predictions based on historical data or past data. Currently, it is already being … Read more

Captive User Interfaces — Why You Should Avoid Them

This tutorial shows you the meaning of captive user interfaces and why they’re discouraged under the Unix philosophy. I’ve written this as a first chapter draft for my upcoming book “From One to Zero” to appear in 2020 with San Francisco-based publisher NoStarch. What’s a Captive User Interface (CUI)? A captive user interface is a … Read more

The Fibonacci Series in Python

The Fibonacci series was discovered by the Italian mathematician Leonardo Fibonacci in 1202 and even earlier by Indian mathematicians. The series appears in unexpected areas such as economics, mathematics, art, and nature. Algorithm Sketch In the following, we give a simple algorithm to calculate the Fibonacci numbers. The series starts with the Fibonacci numbers zero … Read more

Python exec() — A Hacker’s Guide to A Dangerous Function

Python’s exec() function executes the Python code you pass as a string or executable object argument. This is called dynamic execution because, in contrast to normal static Python code, you can generate code and execute it at runtime. This way, you can run programmatically-created Python code. Have you ever wondered about the limits of a … Read more

Data Preprocessing

Introduction Data preprocessing is a technique that is used to transform raw data into an understandable format. Raw data often contains numerous errors (lacking attribute values or certain attributes or only containing aggregate data) and lacks consistency (containing discrepancies in the code) and completeness. This is where data preprocessing comes into the picture and provides a proven method of … Read more

Python complex() — A Useless Python Feature?

The Python complex() method returns a complex number object. You can either pass a string argument to convert the string to a complex number, or you provide the real and imaginary parts to create a new complex number from those. This article shows you how to use Python’s built-in complex() constructor. You’ll not only learn … Read more

Python Default Arguments

This tutorial introduces the concept of default arguments in Python. A default argument is a function argument that takes on a default value if you don’t pass an explicit value for when calling the function. For example, the function definition def f(x=0): <body> allows you to call it with or without the optional argument x—valid … Read more

Как преобразовать список чисел с плавающей запятой в список целых чисел в Питоне

Самый питонический способ преобразовать список чисел с плавающей запятой fs в список целых чисел – использовать однострочный код fs = [int (x) for x in fs]. Он перебирает все элементы в списке fs, используя понимание списка, и преобразует каждый элемент списка x в целочисленное значение с помощью конструктора int (x). В этой статье показаны простейшие … Read more

Как преобразовать список целых чисел в список чисел с плавающей запятой в Питоне

Самый питонический способ преобразовать список целых чисел fs в список чисел с плавающей запятой – использовать однострочный код fs = [float (x) for x in fs]. Он перебирает все элементы в списке fs, используя понимание списка, и преобразует каждый элемент списка x в целочисленное значение с помощью конструктора float (x). В этой статье показаны простейшие … Read more

Python staticmethod()

Static methods are special cases of class methods. They’re bound to a class rather than an instance, so they’re independent on any instance’s state. Python’s built-in function staticmethod() prefixes a method definition as an annotation @staticmethod. This annotation transforms a normal instance method into a static method. The difference between static (class) methods and instance … Read more

String Slicing in Python

String slicing is a concept to carve out a substring from a given string. Use slicing notation s[start:stop:step] to access every step-th element starting from index start (included) and ending in index stop (excluded). All three arguments are optional, so you can skip them to use the default values (start=0, stop=len(string), step=1). For example, the … Read more

Python classmethod()

Python’s built-in function classmethod() prefixes a method definition in a class as an annotation @classmethod. This annotation transforms a normal instance method into a class method. The difference between class and instance method is that Python passes the class itself as a first implicit argument of the method rather than the instance on which it … Read more