Posts

Showing posts from March, 2020

Python Comments Tutorial | Types of Python Comments

Image
The ability to comment on the source code appears in all programming languages. A comment is a non-executable line of text, this means that the compiler or interpreter  will not take it as a line of code. the comments. In Python, as well as in other programming languages, they serve to leave small explanations about what the program does. We know that it is very difficult to remember every aspect of our program, especially when we work on long and complicated projects. Python, being a simple language in syntax issues , helps us to properly document our code without much effort. This is a necessary practice and good developers will make great use of comments. Without this, the source code can get confusing really fast. Types of Python Comments : In Python make comments in two ways. Writing the numeral symbol (#) at the beginning of the line of text where we want our comment. By typing triple quotation marks (') at the beginning and end of the comment , in this case the c...

Python Variables Tutorial With Examples

Image
Python is an interpreted artificial language of dynamic typing whose philosophy emphasizes a syntax that favors readable code. It's a multiparadigm artificial language and available on several platforms.  Python contains a large number of libraries, data types and functions incorporated in the language itself, which help to perform many common tasks without having to program them from scratch. But what really makes it brilliant using it on a Raspberry Pi, is the  ability to use GPIO pins to connect the physical world with the digital world . Variables in Python Programming: A variable is a site where we store certain information. Depending on the type of information we store (text, numbers, Boolean, etc.), the variable will be of one type or another. For simplicity we will only see the text and numerical variables, since they are the ones that are used in more than 80% of the occasions. Each variable has to have a name with which to refer to it. Python ta...

How to Install Python on Windows

Image
How to Install Python on Windows? The process of installing Python on a Windows system follows the same procedure that is used for other types of applications. The main difference is to find the downloaded file so you can begin the installation process. The following procedure should work fine on any Windows system, if the 32-bit or 64-bit version of Python is used. Find the downloaded copy of Python on your system. The name of this file varies, but it usually appears as python-3.3.4.msi for 32-bit systems and python-3.3.4.amd64.msi for 64-bit systems. The version number is incorporated as part of the file name. In this case, the file name refers to version 3.3.4. Double click on the installation file. You may see an open file - Security Warning dialog box asking if you want to run this file. Click Run if you see this pop-up dialog box. You will see a Python Settings dialog box. The exact dialog you see depends on the version of the Python installation program downloa...

Binomial Probability Distribution Tutorial

Image
In statistics , the binomial distribution is a discrete probability distribution that indicates the number of successes when performing a sequence of n independent trials with each other, with a fixed probability (p) of success occurring between those trials. The binomial distribution is one of the theoretical probability distribution models that is used when the discrete random variable is the number of successes in a sample composed of n observations. It is one of the most useful probability distributions used in quality control, production, research, etc. Binomial Distribution in Data Science : The Binomial Distribution is related to the Bernoulli distribution which is a random variable distribution X that takes only values ​​of zero and one (success and failure), when a single experiment is performed. The binomial distribution is applied when a "n" number of times the Bernoulli experiment is performed, each trial being independent of the previous one. The var...

Python Inheritance Tutorial | Inheritance In Python with Examples

Image
What is Inheritance in Python? Inheritance is the ability of one class to inherit the attributes and methods of another, something that allows us to reuse code and make programming much more optimal. It is a powerful feature in object-oriented programming. To see its usefulness, in this lesson we will develop an example. We will start from a class without inheritance with many attributes and we will break it down into other simpler classes that allow us to work better with your data. Python inheritance syntax class BaseClass: Base class body class Derived Class (Base Class): Derived class body The derived class inherits characteristics of the base class, adding new features. This results in code reuse. Inheritance in Python with Example Many years ago I found myself in need of designing a structure for a store that sold three types of products: ornaments, food and books. All products in the store had a series of common attributes, such as reference, name,...