# What is Numpy?

Numpy is a module that contains several classes, functions or variables, etc. To do with scientific calculations in Python. Numpy is useful to create and also process single and multidimensional arrays.

An array is an object that store a group of elements of same data type it means that in case of numbers we can store only integer or only float but not one integer and one is a float. If you want to work with Numpy we need to import the Numpy module.

Example 1:

import numpy
arr=numpy.array([1,2,3,4,5,6,7])
print(arr)
output:
array([1,2,3,4,5,6,7])

Example 2:

import numpy np
arr=np.array([1,2,3,4,5,6,7])
print(arr)
output:
array([1,2,3,4,5,6,7])

Example 3:

from numpy import*
arr=array([1,2,3,4,5,6,7])
print(arr)

output:
array([1,2,3,4,5,6,7])

Creating an array can be done in several always:

1.Using array()function

2.Using arrange()function

3.Using Zeroes() and once() function

### 1.Using array()function:

>>arr=array([1,2,3,4,5,6,7],int)

>>type(arr)

<class 'numpy.nparray'>

>>arr

array([1,2,3,4,5,6,7]

>>arr=array([1.5,2.4,3.7,4.3,5.8,6.9,7.1],int)

>>arr

array([1,2,3,4,5,6,7])

>>arr=array([1.5,2.4,3.7,4.3,5.8,6.9,7.1],float)

>>arr

array([1.5,2.4,3.7,4.3,5.8,6.9,7.1])

For String no need to specify data type

>arr=array(['a','b','c'])

>>print(arr)

['a' 'b' 'c']

### 2.Using arrange()function:

arrange(start,stop,steppoint)
>>from numpy import*
>>a=arrange(2,11,2)
>>>a
array([2,4,6,8,10])

### 3. Creating an array using zeros() and ones() functions:

zeros(n, datatype) --> create array with all zeros
ones(n,datatype)--> create array with all 1's
>> from numpy import*
>> a=zeros(5, int)
>>a
array([0,0,0,0,0])
>> b= ones(5,int)
>>b
array([1,1,1,1,1])

### Mathematical Operations on arrays:

>>arr = array([1,2,3,4,5])
>>arr1=arr+5
>>arr1
array([6,7,8,9,10])

## What is a Loop?

A loop is a sequence or order of instructions that are frequently repeated until a certain condition reached.

1.for loop

2.while loop

3.nested loop

## for loop:

for( i =0;i<n;i++) —–> Which is not implemented in Python

>>> for i range(3)
>>>print(i)
Output:
0
1
2
3
>>> for i in range(1,4)
>>>print(i)
1
2
3

Examples:

for_example_demo.py

1. To do the operation on each and every element of a list

a=[1,2,3,4,5]
b=0
for i in a;
b=b+i
print(b)

a=[1,2,3,4,5]
for i in a;
print(i**2)
b=[(i**2)for i in a]
print(b)

## for with if:

student_marks = [10,36,53,28,90]
for data in student_marks:
if(data%2==0)
print(data, "is even number")
else:
print(data,"is odd number")

## for loop with else clause:

numbers = [10,20,30,40,50,60]
for i in numbers:
print(i)
else:
print("Loop completed ")

Looping control statement: A statement that converts the execution of loop from its designated cycle is called a loop control statement. The best example is the Break.

### Break:

To break out the loop we can use a break function

syntax:

for variablie_name in sequence:

statement1

statement2

if(condition):

break

Example

>>>list = [10,20,30,40,50]
>>>for i in list:
if(i==40)
break
print(i)

### Continue statement:

Continue statement is used, Python to jump to the next iteration of a loop.

Example:
list = [10,20,30,40,50]
for i in list:
if(i==40)
continue
print(i)
else:
print("completed")

## While Loop:

While loop is used to execute no.of statements till the condition passed in while loop once a condition is false, the control will come out the loop.

syntax:

while<expression>:

statement1

statement2

>>>while(i<n):
print(i)

infinite loop

while else loop:

a =int(input("Enter integer less 100\n"))
print(a)

Summary: In Python programming language loops are very useful while using programs. In Loops will improve our logical thinking also. Python loops are very simple to learn and improve. Here only tell to for loop and while because these two are a major role in loops environment in Python Programming language

# Python Simple DataTypes:

A datatype represents the type of data stored into a variable or memory in Python also.

Basically, Python has inbuilt datatypes – Already available in python.

And User-defined datatypes – Datatypes created by programmers.

I). Built-in datatypes:

*None Type

*Numeric Types    – int, float, complex

*Sequences         – str, bytes, list, tuple, etc.

*Sets                       – set, frozenset

*Mapping             – dict

### None :

‘None’ datatype represents an object that does not contain any value.

In Java – NULL

In Python – None

### Numeric datatypes:

1.int:

It represents an integer number

It is number without the decimal part and fraction part.

Example:

>>> x=100

>>>type(x)

<class 'int'>

2.float:

Float represents a floating number

A floating number contains decimal part

Example:

>>>x=100.25

>>>type(x)

<class 'float>

3.Complex Data type:

The complex number is number that is written in the form of a+bJ or a+bj

a: real part

b: imaginary part

Example:

>>>a=1+3j

>>>b=5+7j

>>>c=a+b

>>>print(c)

(4+10j)

Bool data  type:

The bool data type in Python represents boolean values.

>>>a=20

>>>b=10

>>>print(a>b)

True

### Sequences in Python:

A sequence represents a group of elements or items.

Mainly 6 types of sequences in Python:

1.str

2.bytes

3.bytearray

4.list

5.tuple

6.range

### Sets:

A set is an unordered collection of elements that is a set. Set does not accept duplicate elements.

Here two types of sets

1.Set datatype:

Set elements should be separated with a comma(,)

Set always print only unique elements.

Example :

>>>a={100,200,300,400,500,100,100}

>>>print(a)

{100,200,300,400,500}

2.frozenset datatype:

Frozenset datatype is a create frozenset bypassing set data

Cannot be modified(update and remove methods will not work)

Example:

>>>x={500,600,700,800}

>>>y=frozenset(x)

>>>type(y)

<class 'frozenset'>
>>>print(y)
frozenset({500,600,700,800})

### Mapping Type:

A map represents a group of elements in the form of key-value pairs so that when a key is given will retrieve a value

The dict datatype is an example of a map. Dict represents a dictionary that contains a pair of elements first one is Key and second one is Value.

Example:

>>>d={10:"Vijay",20:"Murali"}

>>>print(d)

>>>d[10]

"Vijay"

>>>type(d)

<class 'dict'>

# Python Variable:

Think of any number is a variable in Python. Let’s store it for later. When you think of that number, you are holding that value in your head.

It means that capable of being varied or changed.

A variable is a memory location where a programmer can store a value.

Example: Emp no, Emp name etc.

Value is either a string or numeric etc

Example: “Vijay”, 2456

Variables are created when first assigned.

The interpreter allocates memory on the basis of the data type of variable.

The type(string, int, float etc) of the variable is determined by Python.

## Simple Rules for Python Variables:

1. Must begin with a letter (a-z, A-Z) or (_)

Examples:

>>>@@@EmpNumber =10134

SyntaxError: invalid syntax

>>>_EmpNumber =10134

>>>print(_EmpNumber)

10134

2.Must not contain any special characters like ! , @,#,\$ etc.

Examples:

>>>Vijay@=48

SyntaxError: invalid syntax

>>>@@@=0

SyntaxError: invalid syntax

3.Case sensitive

Examples:

>>> product_name = “Phone”

>>>print(Product_name)

Traceback(most recent call last):

File “<pyshell#26>” line 1 in <module>

print(Product_name)

NameError: name ‘Product_name’ is not defined

>>>print(PRODUCT_NAME)

Traceback(most recent call last):

File “<pyshell#27>” line 1 in <module>

print(PRODUCT_NAME)

NameError: name ‘PRODUCT_NAME’ is not defined

4. There are some reserved keywords which you cannot use as a variable name because Python uses them for other things.

Examples:

>>>for = 100

SyntaxError: invalid syntax

Good Variable Name :

I) Choose a meaningful name instead of short names.

II) Maintain the length of a variable name

III) Begin a variable name with an underscore(_) character for a special case.

### Multi Assignment:

a = 100

print (a)

Name = ‘Vijay’

Age = 27

a=b=c=1

print(a)

print(b)

print(c)

Swaping variable

Syntax:

var 1, var 2= var 2, var 1

>>>x=100

>>>y=200

>>>print(x)

100

>>>x,y=y,x

>>>print(x)

20

>>>print(y)

30

### Input Function:

Examples:

>>>a=input()

100

>>>print(a)

100

27

>>>print(age)

27

Summary: Python Variables are very useful for Python learners and simple to learn for developers. In all programming languages, variables are almost the same the major difference is syntax only. Python is simple to learn for developers also. It is the easiest programming language.

# What is Python?

1. Python is an easy to learn, powerful programming language. The application development process much faster and easier.

2. The  Python was coined in the late 1980s and its development was started in December 1989 by Guido van Rossum at the Netherlands.

3. Python was named for the BBC TV show Monty Python’s Flying Circus.

## Why Python?

1.Easy to understand

2.Beginners Language

3.Less Time Complexity

4.Portable

5.Simple to implement

6. Fully libraries support

## Features of Python

1.Interpreted language

2.Easy to learn and use

3.Expressive language

4.Opensource and Free to install

5.Object-Oriented language

6.GUI programming(Tkinter)

## Python Packages:

1.Web development – Django, Web2py, Flask frameworks, etc.

3.Artificial Intelligence – Keras, Scikit, OpenCV

4.GUI – Tkinter

5.Desktop Applications – Jython, WxPython

6.Testing – Splitter Tool, Pytest framework

7.Game development – Pygame

## Python Implementation alternatives.

1.CPython(standard implementation of Python)

2.Jython(Python for Java)

3.Stackless(Python for concurrency)

4.IronPython(Python for .Net)

5.PyPy(Python for Speed)

## Top 7 Easiest Programming Languages to Learn in 2019

In present, the IT market needs the most talented programming language, skilled employees. It tells that which programming language is best for the future.

Now, here are the Top 7 best and easiest programming languages you should try to learn.

1.Python:

At present situation the top easiest programming language is Python. You will think about why? the latest reports that Python showed 456 – percent growth in last year. Coming to business analysis IBM, Netflix uses Python. It is considered for deployment automation and web development mostly. Python is among the easiest programming language to learn and deploy. Majorly two reasons it is the easiest language.

The first reason is the uses very few lines to code for complex code. Secondly, it is a scripting language. So these two reasons are the Python is the easiest language to learn in 2019.

2.JavaScript:

JavaScript is one of the languages are on highly demanding language. JavaScript is a pure scripting language to build web applications anyway of its complexity. Nowadays it is used as Front-end and Back-end of websites. It is also learning simply in 2019 for future scope.

Note: JavaScript is not related to Java. Java is a purely programming language but JavaScript is a Scripting language.

3.Java

Java is among the simplest programming language. You must and should learn because it is highly portable and run anywhere(Platform independent). Java is existence from many years for web applications and Android applications. There is a high demand for Java developers in the present market.

4.Ruby:

Ruby is a friendly scripting language compare with all scripting language. It is also used for web applications and android application development. Easily readable language and similar to Python so it is simple to learn in 2019.

5. Go

Go is a Google open source programming language and limited structured typing. Go is mostly used for network applications and web servers.

6. C and C++:

C and C++ languages are great to learn because it is impacted by many other languages. Easily learn Java also because it logically jumps simply. It is used for software development, web applications. It is also learning most preferable for 2019.

7.C#

C# is a good choice for whoever coming to IT sector like freshers to be simple startup time. It is used for web development to console applications. This syntax is also the same as C and C++. Little bit complex compiler.

## Why Python is Magnificent Growth in Programming Language

Nowadays Python is the magnificent growing major programming language. According to Stack OVerflow which has already achieved significant by many people, is an incredible growth in programming language because below information tagged into Python.

The latest reports that Python showed a 456 – percent growth in last year. Coming to business analysis IBM uses Python and Netflix uses Python and some of more companies are uses Python.

Python is considered for deployment automation and web development mostly. And a number of reasons are there driving the popularity in a programming language.

# 1) Simplicity:

Python is a simple language to learn and develop. Python code is simple to understand and Object Oriented Programming is supported.

# 2)  Future Scope:

Python is dominating the future technologies that rely on Python. Like Artificial Intelligence, Machine Learning, Big data analytics, and Networking. In Python have different frameworks, libraries and variety of tools are in below for AI:

I) Machine Learning – MDP Toolkit, PyML, PyBrain, GraphLap Create

II) Natural Language: Quepy, NLTK

III) Neural Networks: PyAnn, neuro lab.

And some are related to Big Data analytics :

I)PySpark

II)Pandas

III)Agate

IV)GraphLab Create etc.

In Networking :

I) Ansible

II)Pyeapi

III) NAPALM etc.

# 3) Versatility :

Python supports multiple systems and platforms for a variety of purpose from web development to digital systems operations. It is mostly used to create video games in unlimited application

# 4) Web Assets:

Python provides customization of web assets easy and efficient code. In web development one of the best frameworks is Django. It is a several powerful GUI framework in Python for code re-usability.

## Conclusion :

Above reasons will not be preferable to assume that the popularity of Python will only grow in the upcoming years.

# Top Most Frameworks in Python:

At present in IT Python is most rated programming language because it is very simple to learn and use. And Python has a wide range of applications.

## Python:

Python is an interpreted, dynamically and high-level language. It is based on Object-oriented programming language(OOPS).  In development centers with Python will require a framework to code. At the time we used Python frameworks.

Best Python Frameworks:

## 1. Django

Django is one of the most popular open source Python web framework. It is very useful for freshers and experienced Python programmers. Django is complete with database engines while coming to real-time applications like Instagram by Django. Finally, it is kind of a website it contains JSON, XML, RSS.

Django helps developers to create complex code and applications in an easier way and time complexity also less. Some features like URL routing ORM, O-Auth, database schema migrations, etc.

Flask is one of the powerful programming languages we can use Python to develop standalone applications like apps. It has own template known as Jinja. Nowadays Flask is considered more Python developers than Django because in common situations the equivalent Flask Web application is more explicit. Flask is also easy to get with boilerplate code.

Example :

@app.route(‘/’)

def FirstProgram():

if_name_ ==’_main_’:

app.run()

### 3. Sanic:

Sanic is an easy open source of Python 3.5+. Sanic is similar to Flask function but here a little bit different is Faster compare with Flask. Sanic mainly HTTP responses with the help of asynchronous requests it means that can use the new shiny async /await syntax from Python and non-blocking.

Example :

from sanic import Sanic

app = Sanic()

@app.route(“/”)

async def demo(request);

return (“First Demo”)

if _name_ == “_main_”:

app.run(host = “0.0.0.0”, port = 8081)

### 4. CherryPy :

CherryPy is an open source of Python. It allows developers to build web application sometimes using object-oriented Python framework. It will take less time complexity during developing source code and it has won multi-threaded web server.CherryPy is a reliable, HTTP/1.1 compliant, Web Server Gateway Interface threaded pooled web server and it runs multiple HTTP servers at once.

Example:

from cherrypy import Cherrypy

class FirstDemo{

def index(self)

return “First Demo in CherryPy”

index.exposed= True

cherrypy.quickstart(FirstDemo())

### 5. Web2py :

Web2py is an opensource, fast, scalable, secure, full – stack and web-based application framework. Web2py is a portable , code editor, debugger and deployment tool and it uses LDAP for authentication in Security. It is mainly used for built-in components to handle HTTP request, responses, cookies, and sessions. To ability to read multiple protocols. And it follows MVC (Model – View – Controller) pattern.

Example:

def FirstDemo();

response.view = ‘simple example

return dict(message= ( “First Demo”))

### Conclusion:

Above Python frameworks are most preferable compare with other frameworks. Remaining also most versatile frameworks nowadays.