introduction to modern python
Tags: python, programming, webdev, datascience
Published: 2022-02-13 17:40:29

**

## What is python ?
**
Python is an interpreted, general, high-level programming language invented by Guido van Rossum and released in 1991.

**

## Installing and setting up python environment 

**
**Python installation steps**
1. Visit https://www.python.org/downloads/
2.Select your Operating system(Windows,Linux/UNIX,MacOS,Other
3. Select the release or version, click on it to download.
4.Double click on the file to execute and install. For window mark "add to system paths" An alternative way to install python on Linux is to run sudo apt install python3 or sudo apt install python on the terminal.
5. For more check on the python documentation for more documentations.

**Check installed python**
1. Open Terminal on Linux or cmd on windows
 ** Run the python --version command to check if you  **installed the correct version. if python is installed, the output will be similar to as below:

## Lets run some few code in python
 
**1.Print() function in python **
print() in python is a useful built 
in function that we can use to display input value as text in the output.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pyxue2axmlp6f1w618dd.PNG)



**2.Variable in python **
Variables are used to store information to be referenced and manipulated in a computer program.
Creating a new variable in python is very simple, let's create one together, here in this example below the variable name is month, the equal sign is the assignment operator and the value of the variable is 12

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hmt6lkxayn148iunr8xw.PNG)

**3. Data Type in Python **
 Integers, Floats, Booleans, Strings, Lists, Tuples, Sets, Dictionaries
**Integer ** - these  are whole numbers 
**Floats **- these are Numbers with a decimal point, such as 3.14, are called floating-point numbers (or floats).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dj9yxsnwz8opg9ucydai.PNG)

**Bool -** Bool is another data type that is commonly used in Python. Bool is short for Boolean which can have a value of either True or False. Boolean algebra is the branch of algebra in which the values of the variables are the truth  values true or false. Boolean algebra uses the framework on which all electronic devices are built and exists fundamentally in every line of code inside a computer. In python we can easily assign boolean values like this: 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x74zzpmf8cw0wmblwyjp.PNG)
**Strings** - Python has another datatype in its toolkit called as Strings, as the name suggests this data type deals with characters words and text. String is an immutable order of sequences of characters (eg, Letters, numbers, spaces and symbols. We will be explaining what immutable order means later on.You can create a string by using quotes as seen here, you can use either single / double quotes they both work equally well but there are some cases where you might prefer one over the other which we will be discussing below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vm3kc4lqnq0s9j3r5465.PNG)

**Lists** - A list is one of the most common and basic data structures in Python. It is a mutable ordered sequence of elements.The code below defines a variable students which contains a list of strings. Each element in the list is a string that signifies the name of a student.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a819z4mp61472hsdy9da.PNG)
**Dictionaries** -dictionaries help us store complicated data, which is not single valued like a number or a string

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9dez6zuckyughpnh20iy.PNG)

## What is python used for ?
Python is the most popular programming  language and is used in 
1.Machine learning
2.Software development 
3.Software testing prototyping 
4.Data science 
5.Automation and scripting 

## 

## Advantage of python 

- It has a simple syntax that mimics natural language, so it’s easier to read and understand. This makes it quicker to build projects, and faster to improve on them.

- It’s versatile. Python can be used for many different tasks, from web development to machine learning.

- It’s beginner friendly, making it popular for entry-level coders.

- It’s open source, which means it’s free to use and distribute, even for commercial purposes.

- Python’s archive of modules and libraries—bundles of code that third-party users have created to expand Python’s capabilities—is vast and growing.

- Python has a large and active community that contributes to Python’s pool of modules and libraries, and acts as a helpful resource for other programmers. The vast support community means that if coders run into a stumbling block, finding a solution is relatively easy; somebody is bound to have run into the same problem before.