On a cold, foggy night in December 1987, a scientist called Guido van Rossum woke up in the middle of the night. He just had a profound dream, and although he didn’t know at the time, it would turn out to be a dream that changed his life and the lives of many others. So he got out of bed and slipped into his pantofles. After throwing some wood in the almost smothered fireplace, he started jotting down as much of this dream as he could remember. A new programing language was born: Python, and this is Python’s history.
Install Python From The Python Installer
Install Python From The Python Installer
As we saw above, installing from the Microsoft Store is mostly for students. However, for professional developers who want more control over the installation with a full-featured environment, using the Full installer is the right way. All we need to do is download the official Python.exe installer and run it on our system.
Follow the below steps to download the full installer:
From a browser, navigate to Python.org’s page to download for Windows.
Select a Python version under “Python Releases for Windows”. As of now, the latest version is 3.9.1.
At the bottom, we can see different installers for both 64-bit and 32-bit systems. For a 32-bit system, we can only install the Windows installer(32-bit) while for a 64 bit, we can install the installer for both 32 and 64-bit. However, for a 64-bit system, the Windows installer(64-bit) is recommended.
Run the downloaded Python installer(assuming we downloaded Python 3.9.1).
Run the downloaded Python installer(assuming we downloaded Python 3.9.1).
Select the Install launcher for all users and Add Python 3.9 to PATH checkboxes as shown below.
Note: Installing newer versions of Python will automatically install Pip and IDLE that can be accessed by running the commands pip and idle on the terminal.
To verify that Python was installed successfully, check as we did under the above heading “Check That Python Was Installed”.
Note: Older versions of Python do not support the Add Python to Path checkbox option that merely helps to set the interpreter in the execution path for us. In case we have to set this manually, check here for instructions.
Note: Older versions of Python do not support the Add Python to Path checkbox option that merely helps to set the interpreter in the execution path for us. In case we have to set this manually, check here for instructions.
The last dialog will ask us to disable the path length limit. Disabling this will allow Python to bypass the 260 characters path length limit set by Windows. In the future, we shall definitely get to use the open() function and os module, and if we would want them to accept or return a longer path above 260 characters, then we should disable this option.
Python - Variable Types
Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.
Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals or characters in these variables.
Assigning Values to Variables
Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables.
The operand to the left of the = operator is the name of the variable and the operand to the right of the = operator is the value stored in the variable. For example −
Multiple Assignment
Python allows you to assign a single value to several variables simultaneously. For example −
Here, an integer object is created with the value 1, and all three variables are assigned to the same memory location. You can also assign multiple objects to multiple variables. For example −
Here, two integer objects with values 1 and 2 are assigned to variables a and b respectively, and one string object with the value "john" is assigned to the variable c.
Standard Data Types
The data stored in memory can be of many types. For example, a person's age is stored as a numeric value and his or her address is stored as alphanumeric characters. Python has various standard data types that are used to define the operations possible on them and the storage method for each of them.
Python has five standard data types −
Numbers
String
List
Tuple
Dictionary
Python Numbers
Number data types store numeric values. Number objects are created when you assign a value to them. For example −
You can delete a single object or multiple objects by using the del statement. For example −
You can also delete the reference to a number object by using the del statement. The syntax of the del statement is −
Python supports four different numerical types −
Python supports four different numerical types −
int (signed integers)
long (long integers, they can also be represented in octal and hexadecimal)