Python: Introduction to Numpy and To create several types of Array

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

Example 2:

import numpy np

Example 3:

from numpy import*


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:



<class 'numpy.nparray'>









For String no need to specify data type



['a' 'b' 'c']

2.Using arrange()function:

>>from numpy import*

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)
>> b= ones(5,int)

Mathematical Operations on arrays:

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

Python Loops

What is a Loop?

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

Types of loops in Python:

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)
>>> for i in range(1,4)


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

for i in a;

2.Return to list

for i in a;
b=[(i**2)for i in a]

for with if:

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

for loop with else clause:

numbers = [10,20,30,40,50,60]
for i in numbers:
           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.


To break out the loop we can use a break function


for variablie_name in sequence:






>>>list = [10,20,30,40,50]
>>>for i in list:

Continue statement:

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

list = [10,20,30,40,50]
for i in list:

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.






infinite loop

while else loop:

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

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 Data Types

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:

It represents an integer number

It is number without the decimal part and fraction part.


 >>> x=100


<class 'int'>


Float represents a floating number

A floating number contains decimal part




<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







Bool data  type:

The bool data type in Python represents boolean values.





Sequences in Python:

A sequence represents a group of elements or items.

Mainly 6 types of sequences in Python:








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 :




2.frozenset datatype:

Frozenset datatype is a create frozenset bypassing set data

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





<class 'frozenset'>

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.







<class 'dict'>

Python Variable

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 (_)


>>>@@@EmpNumber =10134

SyntaxError: invalid syntax

>>>_EmpNumber =10134



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



SyntaxError: invalid syntax


SyntaxError: invalid syntax

3.Case sensitive


>>> product_name = “Phone”


Traceback(most recent call last):

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


NameError: name ‘Product_name’ is not defined


Traceback(most recent call last):

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


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.


>>>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





Swaping variable


var 1, var 2= var 2, var 1










Input Function:






>>>age = input(“Enter your age\n”)

Enter your age




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?Why Python and Features | Packages

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


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.

2.Bigdata – PySpark, DASK, 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.


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.


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.


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.


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.


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 :




IV)GraphLab Create etc.

In Networking :

I) Ansible



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.

Best Frameworks in Python

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 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 :

from flask import Flask



def FirstProgram():

return “First Example of Flask”

if_name_ ==’_main_’:

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()


async def demo(request);

return (“First Demo”)

if _name_ == “_main_”: = “”, 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.


from cherrypy import Cherrypy

class FirstDemo{

def index(self)

return “First Demo in CherryPy” True


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.


def FirstDemo();

response.view = ‘simple example

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


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