Introduction of python-: Python is a most popular programming language. It was created in 1991 by Guido van Rossum. python Is used for web development (server-side), software development,mathematics,system scripting.
Python Features -:We know that the Python is a general purpose, dynamic, high level and interpreted programming language. It support Object Oriented programming approach to develop applications.
How to install python -: After downloading, installing, and starting up Python and IDLE, an integrated development environment for Python. At this writing, Python 3.6 is the most current version, and 3.7 is under development. After years of refinement, Python 3 is the first version of the language that isn’t fully backward-compatible with earlier versions so be sure to get a version of python 3. It should be several years before another such dramatic change occurs, and any future enhancements will be developed with concern to avoid affecting an already-significant existing code base.
Data type in Python -:Python has several built-in data types such as integers, floats, complex numbers, strings, lists, tuples, dictionaries, and file objects. These data types are manipulated using language operators, built-in functions, library functions, or a data type’s own methods.
Global Variable In Python -:Like any other programming language python Variables are nothing but reserved memory locations to store values. This means that when we create a variable we reserve some space in memory.
List in Python -:Python has a powerful built in list types. Lists are like array. A list in Python is much the same thing as an array in Java or C or any other language. It is an ordered collection of objects. we create a list by enclosing a comma-separated list of elements in square brackets
Tuples in Python-:Tuples are data structures this is very similar to lists but tuples can not be modified. Tuples can only be created. Tuples are so much like lists that you may wonder why Python bothers to include them. The reason is that tuples have important roles that ca not be efficiently filled by lists such as keys for dictionaries.
Sets In python-:A set in Python is an unordered collection of objects used when membership and uniqueness in the set are main things we need to know about that object. Like dictionary keys the items in a set must be immutable and hash-able. This means that floats, strings, and tuples can be members of a set, but lists, dictionaries, and sets themselves can not.
String in Python-:Strings can be created by enclosing the character or the sequence of characters in the quotes. Python allows us to use single quotes, double quotes, or triple quotes to create the string
Format String -:Python strings have powerful text-processing features, including searching and replacing, trimming characters, and changing case.Strings are immutable they can not be changed in place.Operations that appear to change strings actually return a copy with the changes.
Dictionary in Python-:Dictionaries are powerful data structures, used for many purposes even within Python itself. Dictionary keys must be immutable, but any immutable object can be a dictionary key. Using keys means accessing collections of data more directly and with less code than many other solutions.
Function in Python -:Functions are the most important aspect of an application. A function can be defined as the organised block of reusable code which can be called whenever required. A function is a block of organised, reusable code that is used to perform a single related action.
Python Lambda Function-: A lambda function is a small anonymous function in python. lambda expressions are anonymous little functions that we can quickly define inline. Normally a small function needs to be passed to another function like the key function used by a list’s sort method. In such cases a large function is usually unnecessary and it would be awkward to have to define the function in a separate place from where it’s used.
Python Modules-: A module is a file containing code. It defines a group of Python functions or other objects and the name of the module is derived from the name of the file.
python exception -: An exception is an object generated automatically by Python functions with a raise statement. After the object is generated the raise statement which raises an exception, causes execution of the python program to proceed in a manner different from what would normally occur.
Class define in Python -:This is the advance python language features . A class in Python is effectively a data type. All the data types built into Python All classes and Python gives us a powerful tools to manipulate every aspect of a class’s behavior. we can define a class with the class statement.
This is the advance feature of object oriented programming.Python has a class method. there are two type class method are available in python..
- Static class method
- Class Method
Inheritance in Python-:Inheritance is an important feature of the object-oriented programming. Inheritance provides code reuse ability to the program because we can use an existing class to create a new class instead of creating it from scratch. For a example there are many birds and every bird has a special species.
Database connection in Python
MySQL Python -:For connecting a database we are using My SQL in python programming.For creating a applications connecting with the databases is the necessity for the programming languages. Python allows us to connect our application to the databases like MySQL, SQLite, MongoDB, and many others.
Connecting MySQL -: For creating Creating a connection using the mysql.connector.connect() function gives access to all connection-related features.
Create a database MySQL-: We can create a database in MySQL .
Create a Table -: By using the create command we can create a table in MySQL .