Tuesday, 27 April 2021

about python

 Python is simple to use, but it is a real programming language, offering much more structure and support for large programs than shell scripts or batch files can offer. On the other hand, Python also offers much more error checking than C, and, being a very-high-level language, it has high-level data types built in, such as flexible arrays and dictionaries. Because of its more general data types Python is applicable to a much larger problem domain than Awk or even Perl, yet many things are at least as easy in Python as in those languages.


Python allows you to split your program into modules that can be reused in other Python programs. It comes with a large collection of standard modules that you can use as the basis of your programs — or as examples to start learning to program in Python. Some of these modules provide things like file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk.


Python is an interpreted language, which can save you considerable time during program development because no compilation and linking is necessary. The interpreter can be used interactively, which makes it easy to experiment with features of the language, to write throw-away programs, or to test functions during bottom-up program development. It is also a handy desk calculator.


Python enables programs to be written compactly and readably. Programs written in Python are typically much shorter than equivalent C, C++, or Java programs, for several reasons:


the high-level data types allow you to express complex operations in a single statement;


statement grouping is done by indentation instead of beginning and ending brackets;


no variable or argument declarations are necessary.


Python is extensible: if you know how to program in C it is easy to add a new built-in function or module to the interpreter, either to perform critical operations at maximum speed, or to link Python programs to libraries that may only be available in binary form (such as a vendor-specific graphics library). Once you are really hooked, you can link the Python interpreter into an application written in C and use it as an extension or command language for that application.

Thursday, 22 April 2021

Python Features and Advantages

 Python Features and Advantages

1. Easy to Code

Python is a very high-level programming language, yet it is effortless to learn. Anyone can learn to code in Python in just a few hours or a few days. Mastering Python and all its advanced concepts, packages and modules might take some more time. However, learning the basic Python syntax is very easy, as compared to other popular languages like C, C++, and Java. 


Let us now look at the next feature of python.


2. Easy to Read

Python code looks like simple English words. There is no use of semicolons or brackets, and the indentations define the code block. You can tell what the code is supposed to do simply by looking at it. 


We will now look into the next feature of python.


3. Free and Open-Source

Python is developed under an OSI-approved open source license. Hence, it is completely free to use, even for commercial purposes. It doesn't cost anything to download Python or to include it in your application. It can also be freely modified and re-distributed. Python can be downloaded from the official Python website.


Let us find out the next feature of python.


4. Robust Standard Library

Python has an extensive standard library available for anyone to use. This means that programmers don’t have to write their code for every single thing unlike other programming languages. There are libraries for image manipulation, databases, unit-testing, expressions and a lot of other functionalities. In addition to the standard library, there is also a growing collection of thousands of components, which are all available in the Python Package Index.


We'll now learn about the next feature of python.


5. Interpreted

When a programming language is interpreted, it means that the source code is executed line by line, and not all at once. Programming languages such as C++ or Java are not interpreted, and hence need to be compiled first to run them. There is no need to compile Python because it is processed at runtime by the interpreter. 


Let us now look at the next feature of python.


6. Portable

Python is portable in the sense that the same code can be used on different machines. Suppose you write a Python code on a Mac. If you want to run it on Windows or Linux later, you don’t have to make any changes to it. As such, there is no need to write a program multiple times for several platforms.


7. Object-Oriented and Procedure-Oriented

A programming language is object-oriented if it focuses design around data and objects, rather than functions and logic. On the contrary, a programming language is procedure-oriented if it focuses more on functions (code that can be reused). One of the critical features of Python is that it supports both object-oriented and procedure-oriented programming. 


8. Extensible

A programming language is said to be extensible if it can be extended to other languages. Python code can also be written in other languages like C++, making it a highly extensible language.


9. Expressive

Python needs to use only a few lines of code to perform complex tasks. For example, to display Hello World, you simply need to type one line - print(“Hello World”). Other languages like Java or C would take up multiple lines to execute this.


10. Support for GUI

One of the key aspects of any programming language is support for GUI or Graphical User Interface. A user can easily interact with the software using a GUI. Python offers various toolkits, such as Tkinter, wxPython and JPython, which allows for GUI's easy and fast development.


11. Dynamically Typed

Many programming languages need to declare the type of the variable before runtime. With Python, the type of the variable can be decided during runtime. This makes Python a dynamically typed language.


12. High-level Language

Python is a high-level programming language because programmers don’t need to remember the system architecture, nor do they have to manage the memory. This makes it super programmer-friendly and is one of the key features of Python.


13. Simplify Complex Software Development

Python can be used to develop both desktop and web apps and complex scientific and numerical applications. Python's data analysis features help you create custom big data solutions without so much time and effort. You can also use the Python data visualization libraries and APIs to present data in a more appealing way. Several advanced software developers use Python to accomplish high-end AI and natural language processing tasks. 


14. Other Advanced Programming Features

Python contains several advanced programming features such as generators (used to create iterators with a different approach that most other languages) and list comprehensions (used to create new lists from other iterables). Python also has automatic memory management eliminating the need to manually allocate and free memory in the code.

Wednesday, 24 February 2021

Introdoction to Python & Installation

 Introduction to Python and installation:

Python is a widely used general-purpose, high level programming language.

It was first introduced in 1991 by Guido van Rossum , a Dutch computer programmer.

• The language places strong emphasis on code reliability and simplicity so that the programmers can develop applications rapidly developed by Python Software Foundation.

It was mainly developed for emphasis on code readability, and its syntax allows programmers to express concepts in fewer lines of code.

Python is a programming language that lets you work quickly and integrate systems more efficiently.

Beginning with Python programming:

1)      Finding an Interpreter: Before we start Python programming, we need to have an interpreter to interpret and run our programs. There are certain online interpreters like https://ide.geeksforgeeks.org/, http://ideone.com/ or http://codepad.org/ that can be used to start Python without installing an interpreter.

2)      Windows: There are many interpreters available freely to run Python scripts like IDLE (Integrated Development Environment) which is installed when you install the python software.

Why to use Python: The following are the primary factors to use python in day-to-day life

1. Python is object-oriented

Structure supports such concepts as polymorphism, operation overloading and multiple inheritance.

2. Indentation : Indentation is one of the greatest feature in python

3. It’s free :(open source): Downloading python and installing python is free and easy

4. It’s Powerful

Ø  Dynamic typing

Ø  Built-in types and tools

Ø  Library utilities

Ø  Third party utilities (e.g. Numeric, NumPy, sciPy)

Ø  Automatic memory management

5. It’s Portable

Ø  Python runs virtually every major platform used today

Ø  As long as you have a compatible python interpreter installed, python

programs will run in exactly the same manner, irrespective of platform.

6. It’s easy to use and learn

Ø  No intermediate compile

Ø  Python Programs are compiled automatically to an intermediate form called

Ø  byte code, which the interpreter then reads.

Ø  This gives python the development speed of an interpreter without the

performance loss inherent in purely interpreted languages.

Ø  Structure and syntax are pretty intuitive and easy to grasp.

7. Interpreted Language

Python is processed at runtime by python Interpreter

8. Interactive Programming Language

Users can interact with the python interpreter directly for writing the programs

9. Straight forward syntax

The formation of python syntax is simple and straight forward which also makes it

popular.

Python is a general purpose interpreted interactive object oriented and high level programming language.

Python is multi-paradigm programming language ,which allows user to code in several different programming styles.

Python supports cross platform development and is available through open source.

 Python is widely used for scripting in Game menu applications effectively.

Python can be easily integrated with C/C++ CORBA, ActiveX and Java.

CPython is a python integrated with C/C++ language.

Similarly JPython is a purely integrated language where Java and Python code can interchangeably use inline in the program.

Working with Python :Python Code Execution:

Python’s traditional runtime execution model: Source code you type is translated to byte

code, which is then run by the Python Virtual Machine (PVM).

 Your code is automatically compiled,

but then it is interpreted.

Source Byte code Runtime

Source code extension is .py

Byte code extension is .pyc (Compiled python code)

There are two modes for using the Python interpreter:

• Interactive Mode

• Script Mode

 m.py

 m.pyc

 Running Python in interactive mode:

Without passing python script file to the interpreter, directly execute code to Python prompt.

Once you’re inside the python interpreter, then you can start.

>>> print("hello world")

hello world

 

Python can be easily integrated with C/C++ CORBA, ActiveX and Java.

• CPython is a python integrated with C/C++ language.

• Similarly JPython is a purely integrated language where Java and Python code can interchangeably use inline in the program.

Advantages of Python

• Most programs in Python require considerably less number of lines of code to perform the same task compared to other languages like C .So less programming errors and reduces the development time needed also.

• Though Perl is a powerful language ,it is highly syntax oriented .Similarly C also.

Why to Learn Python

• There are large number of high-level programming languages like C ,C++,Java etc.But when compared to all these languages Python has simplest Syntax, availability of libraries and built-in modules.

• Python comes with an extensive collection of third party resources that extend the capabilities of the language.

Python can be used for large variety of tasks like Desktop applications ,Data base applications, network programming ,game programming and even mobile development also.

• Python is also a cross platform language which means that the code written for one operating system like Windows ,will work equally well with Linux or MacOS without any changes to the python code.

INSTALLING PYTHON ON YOUR PC

• To learn this language first ,you have to download the software which is the Python Interpreter.

• Presently the version in use is Python 3.x But you can also use Python 2.x ,like 2.7..etc .This depends on your system and your interest. To download the Python interpreter go to the site http://www.python.org/downloads and click on the suitable icon.

The website appears as shown below.

From the website you can download the suitable version based on

your OS (whether the OS is Windows ,  MacOS or Linux).

• And the Processor 32 bit or 64 bit.

For ex: if you are using 64-bit Windows system ,you are likely to download Windowsx86-64MSI Installer.

• So just click on the link and download and install the Python Interpreter.

This Python shell allows us to use Python in interactive mode.

• The shell waits for a command from the user ,executes it and returns the result.

Monday, 8 February 2021

CMS using Python

 What is a CMS?

A content management system - better known as a CMS - is a kind of software that’s designed for the creation and modification of digital content. Among its wide variety of features, it usually offers publishing options, version control, search engine optimization, access control, and different design templates. It streamlines the content creation and publishing processes by providing a simple user interface that supports your marketing strategy, without requiring any advanced technical knowledge from users. It is used to create user friendly environment.

Core functionality and managing assets factors should you pay attention to when choosing a technology to build a CMS?

A good CMS should provide multiple handy out-of-the-box functionalities; this will make working with content easier and more robust. It should also allow for easy asset management.

User interaction:

The CMS should be intuitive and user friendly; it should provide self-explanatory ways to manage content and even add new subpages.

SEO:

A good CMS should be prepared for SEO. The page structure, meta tags, and other auto-generated content have to be SEO-friendly.

Integration with other systems:

The CMS should be a place gathering in one spot different external services and providers necessary for your business to function, such as payment gateways or social media integrations.

Popularity:

It’s super important to choose a technology which is backed by a large community, offers lots of integrations and extensions along with easy-to-find manuals.

Experts:

You need to have access to a broad market of IT specialists who will help you create your ideal team and be able to fill in any rotation gaps.

Performance:

The selected technology should start performing right out of the box, and be easy to install and deploy without bearing additional expenses on external support.

Cloud storage:

You might need a wide range of cloud solutions for installing and storing the entire system.

Security:

It’s safer to select a full-fledged technology - one that has already been tested in many different areas and is supported by a community that deals with any new bugs.

All of these factors appear to be outstanding in Python development.

Why is Python a good language of choice for creating a CMS?

1. Maturity:

Python has two big players in the world of CMSs: Wagtail and Django CMS. Both are well-tested and mature, quality solutions, with a large community of customers, editors and - above all - developers who are constantly working on new features and releasing updates and bug fixes. This is important because it makes the software even more functional and reliable.

2. Ease of use and speed :

Python frameworks are easy to adapt and convert into a tailor-made CMS, while at the same time act like building blocks for programming. This is extremely helpful when it comes to fast delivery with a limited team, as you can have a lot of functions, like contact forms, WYSIWYG editor or page hierarchy without coding, since they are already implemented.

3. Prebuilt admin dashboard:

Both Wagtail and Django CMS are built on top of the Django framework which comes with a prebuilt admin dashboard. This is a huge advantage in terms of the speed of developing a CMS that has a built-in space for admins to manage content, users, and so on. You can get a sneak peek by clicking on the links: DjangoCMS/Wagtail.

4. Advanced and ready-to-use features:

The biggest advantages of Python frameworks include: simplicity of deployment, the availability of cloud solutions (like AWS, GCP or Heroku) and a lot of single-click tools that make it possible to establish proper CI/CD pipelines for high degrees of automation in the process of delivering new code. These and many other things guarantee that your product will be well-tested and resistant to time.

What is crucial from business perspective?

All of these points are not only significant for devs, but also crucial from a business perspective.

When you use a mature and relatively secure framework backed by so many experts, you don’t have to spend a lot of time and money on any additional support.

You also have more specialized developers to choose from. Looking for someone to fill a vacancy is not so problematic.

The ease of use and many built-in features already available in the framework make development go much faster. It’s also more efficient and less costly.

The further development of your CMS also becomes simpler, so you can think about unwinding its full potential, making it as made-to-measure as possible.

Remember: if you don’t adjust the technology required for building a CMS properly, this may result in a lengthier development and very poor support in the case of a critical situation. There’s also a big chance that you will be dramatically limited by its functions, so scaling may be a nightmare. You might spend a lot of money on solving problems that wouldn’t have occurred if you had just selected a better option.

This is why creating a Python-based CMS may be the safest alternative.

Tuesday, 17 November 2020

PYTHON-Course-Classes and Object-oriented Programming


 PYTHON-Classes and Object-oriented Programming

A user-defined prototype for an object that defines a set of attributes that characterize any object of the class.

The attributes are data members (class variables and instance variables) and methods, accessed via dot notation.

 OOP Terminology Class:

Class variable − A variable that is shared by all instances of a class. Class variables are defined within a class but outside any of the class's methods. Class variables are not used as frequently as instance variables are.

Data member − A class variable or instance variable that holds data associated with a class and its objects.

Function overloading − The assignment of more than one behaviour to a particular function. The operation performed varies by the types of objects or arguments involved.

 Instance variable – A variable that is defined inside a method and belongs only to the current instance of a class.  

Inheritance − The transfer of the characteristics of a class to other classes that are derived from it.  

Instance − An individual object of a certain class. An object obj that belongs to a class Circle, for example, is an instance of the class Circle.

 Method − A special kind of function that is defined in a class definition.

 Object − A unique instance of a data structure that's defined by its class. An object comprises both data members (class variables and instance variables) and methods.

 Operator overloading − The assignment of more than one function to a particular operator.


 #Class Constructor Function class Employee: #Common base class for all employees empCount = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.empCount += 1 def displayCount(self): print "Total Employee %d" ,Employee.empCount def displayEmployee(self): print "Name : ", self.name, ", Salary: ", self.salary #Creating Instance Object emp1 = Employee("Zara", 2000) emp2 = Employee("Manni", 5000) #Accessing Object emp1.displayEmployee() emp2.displayEmployee() print "Total Employee %d" % Employee.empCount The first method __init__() is a special method, which is called class constructor or initialization method that Python calls when you create a new instance of this class. To create instances of a class, you call the class using class name and pass in whatever arguments its __init__ method accepts. You access the object's attributes using the dot operator with object. Class variable would be accessed using class name as follows −

class Employee: 'Common base class for all employees' empCount = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.empCount += 1 def displayCount(self): print ("Total Employee %d" % Employee.empCount) def displayEmployee(self): print ("Name : ", self.name, ", Salary: ", self.salary) "This would create first object of Employee class" emp1 = Employee("Zara", 2000) "This would create second object of Employee class" emp2 = Employee("Manni", 5000) emp1.displayEmployee() emp2.displayEmployee() print ("Total Employee %d" % Employee.empCount)

 Calc Via Class class cal(): def __init__(self,a,b): self.a=a self.b=b def add(self): return self.a+self.b def mul(self): return self.a*self.b def div(self): return self.a/self.b def sub(self): return self.a-self.b a=int(input("Enter first number: ")) b=int(input("Enter second number: ")) obj=cal(a,b) choice=1 while choice!=0: print("0. Exit") print("1. Add") print("2. Subtraction") print("3. Multiplication") print("4. Division") choice=int(input("Enter choice: ")) if choice==1: print("Result: ",obj.add()) elif choice==2: print("Result: ",obj.sub()) elif choice==3: print("Result: ",obj.mul()) elif choice==4: print("Result: ",round(obj.div(),2)) elif choice==0: print("Exiting!") else: print("Invalid choice!!") print()

 Built-In Class Attributes Every Python class keeps following built-in attributes and they can be accessed using dot operator like any other

Destroying Objects (Garbage Collection) / Destruction :

 Python deletes unneeded objects (built-in types or class instances) automatically to free the memory space. The process by which Python periodically reclaims blocks of memory that no longer are in use is termed Garbage Collection.

Python's garbage collector It runs during program execution and is triggered when an object's reference count reaches zero. An object's reference count changes as the number of aliases that point to it changes.

 You normally will not notice when the garbage collector destroys an orphaned instance and reclaims its space. But a class can implement the special method __del__(), called a destructor, that is invoked when the instance is about to be destroyed. This method might be used to clean up any non memory resources used by an instance.

class Point: def __init__( self, x=0, y=0): self.x = x self.y = y def __del__(self): class_name = self.__class__.__name__ print (class_name, "destroyed") pt1 = Point() pt2 = pt1 pt3 = pt1 print (id(pt1), id(pt2), id(pt3)) # prints the ids of the obejcts del pt1 del pt2 del pt3

Class Inheritance:  Instead of starting from scratch, you can create a class by deriving it from a pre-existing class by listing the parent class in parentheses after the new class name.

The child class inherits the attributes of its parent class, and you can use those attributes as if they were defined in the child class. A child class can also override data members and methods from the parent.

Syntax Derived classes are declared much like their parent class; however, a list of base classes to inherit from is given after the class name − class SubClassName (ParentClass1[, ParentClass2, ...]): 'Optional class documentation string‘

Get And SET Attribute Get and set attribute of objects. The syntax of setattr() method is: 

setattr(object, name, value) setattr() Parameters The setattr() method takes three parameters

object - object whose attribute has to be set .

 name - string which contains the name of the attribute to be set

 value - value of the attribute to be set


class Person: name = 'Adam' p = Person() print('Before modification:', p.name) # setting name to 'John‘ setattr(p, 'name', 'John') print('After modification:', p.name) #Mainly GET and SET used for …. class Person: name = 'Adam' p = Person() # setting attribute name to None setattr(p, 'name', None) print('Name is:', p.name) # setting an attribute not present # in Person setattr(p, 'age', 23) print('Age is:', p.age)

 Get Attribute The getattr() method returns the value of the named attribute of an object. If not found, it returns the default value provided to the function.

The syntax of getattr() method is: getattr(object, name[, default]) getattr() Parameters The getattr() method takes multiple parameters:

 object - object whose named attribute's value is to be returned

name - string that contains the attribute's name

default (Optional) - value that is returned when the named attribute is not found

#E.G. class Person: age = 23 name = "Adam“ person = Person() # when default value is provided print('The gender is:', getattr(person, 'gender', 'Male')) # when no default value is provided print('The gender is:', getattr(person, 'gender'))


 #Inheritance Example class Parent: # define parent class parentAttr = 100 def __init__(self): print ("Calling parent constructor") def parentMethod(self): print ('Calling parent method') def setAttr(self, attr): Parent.parentAttr = attr def getAttr(self): print ("Parent attribute :", Parent.parentAttr) class Child(Parent): # define child class def __init__(self): print ("Calling child constructor") def childMethod(self): print ('Calling child method') c = Child() # instance of child c.childMethod() # child calls its method c.parentMethod() # calls parent's method c.setAttr(200)

 # again call parent's method c.getAttr() # again call parent's method

Overriding Methods - You can always override your parent class methods. One reason for overriding parent's methods is because you may want special or different functionality in your subclass. 

 Example class Parent: # define parent class def myMethod(self): print ('Calling parent method vadil') class Child(Parent): # define child class def myMethod(self): print ('Calling child method 6okrav') c = Child() # instance of child c.myMethod() # child calls overridden method.


What is MRO :

 A class can be derived from more than one base classes in Python. This is called multiple inheritance.

 In multiple inheritance, the features of all the base classes are inherited into the derived class. The syntax for multiple inheritance is similar to single inheritance.

 E.g.. class Super1: pass class, Super2: pass class

    MultiDerived(Super1, Super2): pass - In the multiple inheritance scenario, any specified attribute is searched first in the current class. If not found, the search continues into parent classes in depth-first, left-right fashion without searching same class twice. - MRO Stand for Method resolution Order.So, in the above example of MultiDerived class the search order is [MultiDerived, Super1, Super2, object]. This order is also called linearization of MultiDerived class and the set of rules used to find this order is called Method Resolution Order (MRO).

 MRO ensures that a class always appears before its parents and in case of multiple parents, the order is same as tuple of base classes.


Duck Typing : Duck typing is a concept that says that the “type” of the object is a matter of concern only at runtime and you don’t need to to explicitly mention the type of the object before you perform nay kind of operation on that object.

 You don’t need to define the type of things like int,float etc…its called duck typing.

 The following example can help in understanding this concept –

def calc(a,b):

 return a+b

                Method Overloading : Same name different arguments in method that is called an method overloading.

Python doesn’t support method overloading but if we want to do then we can do as per below. ###

Error def product(a, b): p = a * b print(p) def product(a, b, c): p = a * b*c print(p) #product(4, 5) product(4, 5, 5)

 It’s Work If Different Arguments as a Parameter # Function to take multiple arguments def add(datatype, *args): # if datatype is int # initialize answer as 0 if datatype =='int': answer = 0 # if datatype is str # initialize answer as '' if datatype =='str': answer ='' # Traverse through the arguments for x in args: # This will do addition if the # arguments are int. Or concatenation # if the arguments are str answer = answer + x print(answer) # Integer add('int', 5, 6) # String add('str', 'Hi ', 'Geeks')

 Abstract Class Force a class to implement methods. Abstract classes can contain abstract methods: methods without an implementation. Objects cannot be created from an abstract class. A subclass can implement an abstract class. Meaning of @ This shows that the function/method/class you're defining after a decorator is just basically passed on as an argument to the function/method immediately after the @ sign.

What is __MetaClass__:import abc class AbstractAnimal(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def walk(self): ''' data ''' @abc.abstractmethod def talk(self): ''' data ''' class Duck(AbstractAnimal): name = '' def __init__(self, name): print('duck created.') self.name = name def walk(self): print('walks') def talk(self): print('quack') obj = Duck('duck1') obj.talk() obj.walk()

ABOUT PYTHON

INTRODUCTION:

Like Other Programming Languages like C programming, It is concern with functional aspect.

 We are concerning with writing code using function.

 Programming will become easy if it based on real life example, hence they develop Object Oriented Language like Java and .NET where programming done with Classes and Objects.

 Java Program to Write sum of two numbers

 C program to write sum of two numbers • Python style • a=b=10 • print(“sum”,(a+b))

 

HISTORY of PYTHON:-

 Python was developed by Guido Van Rossum in year 1991, at center for mathematics and Computer science managed by Dutch Govt. Developer was working on project to develop system utilities in C where he had interact with bourn shell available in UNIX.  Python name appeared from the TV Show Monty Python’s Flying Circus  Official launched on 20th Feb 1991.  Python is Open Source.

FEATURES OF PYTHON:- Simple  Easy to learn  Open Source  High level Language  Dynamically Typed  Platform Independence  Portable  procedure and Object oriented

Simple-Python is simple programing Language .felt like reading English sentences. It means more clarity and less stress on understating of syntax of language

 Easy to learn– uses very few keyword , program structure is simple. Similar to C programing . Hence Migration from C to Python is easy for programmers.

 Open Source - easily available for download www.python.org

 High level Language – Similar to English Language , low level language Machine understandable code.

 Dynamically Typed-in - Python , we are not declaring anything. an assignment statement binds a name to an objects can be of any type. If a name is assigned to an objects of one type, it may be later be assigned to an objects of different type.

 >>>year = 2017  >>> dec = 1.1  >>> hello = 'Hello, World!'  >>> alphabet = ['a','b','c']


As you can see, I didn’t have to tell Python what ‘type’ each variable value was, it assigned the types dynamically  Platform Independent-  Portable  Procedure and OOPS based.

Class is collection of objects having similar attributes and operation.  

Python Packages: 

Boto: It is amazon web services  CherryPy is Object oriented HTTP framework  Fiona reads and write big data files. Mysql-connector –python is driver written in python to connect to MySQL database

Numpy- It is a package for processing array of single or multidimensional type  Pandas is package for powerful data structure for data analysis, time series and statistics  Pillow is python imaging library.

Pyquery- represent jquery like library for python.  W3lib is library of web related function.

 

EXECUTION OF PYTHON PROGRAM:- Python program can write in abc.py where abc is name of the program wheras .py is extension name.  Compile the program into python compiler.  Byte code.  Abc.pyc   Pvm  machinecode  result

C VS PYTHON:  Python Programing C program execute Faster Slower compared to C Type Declaration Compulsory Not required C language type discipline in static and weak Python type discipline is dynamic and Strong Pointers available No Pointers C ha s switch statements No switch statement Memory allocation using malloc and calloc Memory allocation and De-allocation done by PVM Procedural approach Oops based.

 JAVA VS PYTHON JAVA PYTHON:  Memory allocation and de-allocation done by JVM PVM Switch is allowed No switch A semicolon is used to terminate the statement and comma is used to separate expression. New line indicate end of statement and semicolon is used as an expression separator Array index is positive integer Can be positive or negative. Static and weak Dynamic and strong Oops languages, functional programming used in java 8.0 in lamda expression Oops language, blends functional programming with lambda expression inbuild.

PVM:-  Python source file converted in Byte Code format.

 Byte code represent the fixed set of instruction created by python developers representing all types of operations.  And store that file in .pyc extension

 Role of PVM to convert that byte code into machine understandable code, so that computer can execute that machine code and display result.  To carry out this conversion , byte code into machine code and sends that machine code to computer processor for execution. Since Interpreter plays main role, often pvm also mention as interpreter.

 FROZEN BINARIES:- Frozen binary executables are packages that combine your program's byte code and the Python interpreter into a single executable program. With these, programs can be launched in the same ways that you would launch any other executable program (icon clicks, command lines, etc.).  py2exe

MEMORY MANAGEMENT IN PYTHON:- Python , memory allocation and de-allocation are done during runtime automatically.  The programmer need not allocate memory while creating objects or deallocate memory when deleting the objects. Python PVM take care of such issues.  Everything is consider as an objects in Python. Example Strings are objects, list are objects , functions are objects. For every object, memory should be allocated .memory manager inside PVM allocates memory required for the objects created in Python Programming .  All these objects are stored on separate memory called Heap.  Heap is memory which allocated during runtime.

GARBAGE COLLECTION IN PYTHON:- Python’s memory allocation and de-allocation method is automatic. Python uses two strategies for memory allocation:  Reference counting  Garbage collection  the Python interpreter only used reference counting for memory management. Reference counting works by counting the number of times an object is referenced by other objects in the system. When references to an object are removed, the reference count for an object is decremented. When the reference count becomes zero, the object is de-allocated.

about python

 Python is simple to use, but it is a real programming language, offering much more structure and support for large programs than shell scri...