Python

Python is a high-level general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
==Overview==
Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a "batteries included" language due to its comprehensive standard library.
Guido van Rossum began working on Python in the late 1980s as a successor to the ABC programming language and first released it in 1991 as Python 0.9.0. Python 2.0 was released in 2000. Python 3.0, released in 2008, was a major revision not completely backward-compatible with earlier versions. Python 2.7.18, released in 2020, was the last release of Python 2.
==Uses==
Python is a general purpose programming language that can be used for various applications, such as:
*Web and software development
*Data analytics and visualization
*Machine learning
*Design
*Scientific and numeric computing
*Network programming
*Games and 3D applications
*Task automation
*Build control and management
*Testing
*Bug tracking and project management
==Syntax and semantics==
Python is meant to be an easily readable language. Its formatting is visually uncluttered and often uses English keywords where other languages use punctuation. Unlike many other languages, it does not use curly brackets to delimit blocks, and semicolons after statements are allowed but rarely used. It has fewer syntactic exceptions and special cases than C or Pascal.https://web.archive.org/web/20121024164224/http://docs.python.org/faq/general.html#is-python-a-good-language-for-beginning-programmers
===Indentation===
Python uses whitespace indentation, rather than curly brackets or keywords, to delimit blocks. An increase in indentation comes after certain statements; a decrease in indentation signifies the end of the current block.
===Statements and control flow===
*The assignment statement, using a single equals sign =
*The if statement, which conditionally executes a block of code, along with else and elif (a contraction of else-if)
*The for statement, which iterates over an iterable object, capturing each element to a local variable for use by the attached block
*The while statement, which executes a block of code as long as its condition is true
*The try statement, which allows exceptions raised in its attached code block to be caught and handled by except clauses (or new syntax except* in Python 3.11 for exception groups); it also ensures that clean-up code in a finally block is always run regardless of how the block exits
*The raise statement, used to raise a specified exception or re-raise a caught exception
*The class statement, which executes a block of code and attaches its local namespace to a class, for use in object-oriented programming
*The def statement, which defines a function or method
*The with statement, which encloses a code block within a context manager (for example, acquiring a lock before it is run, then releasing the lock; or opening and closing a file), allowing resource-acquisition-is-initialization (RAII)-like behavior and replacing a common try/finally idiom
*The break statement, which exits a loop
*The continue statement, which skips the rest of the current iteration and continues with the next
*The del statement, which removes a variable—deleting the reference from the name to the value, and producing an error if the variable is referred to before it is redefined
*The pass statement, serving as a NOP, syntactically needed to create an empty code block
*The assert statement, used in debugging to check for conditions that should apply
*The yield statement, which returns a value from a generator function (and also an operator); used to implement coroutines
*The return statement, used to return a value from a function
*The import and from statements, used to import modules whose functions or variables can be used in the current program
*The match and case statements, an analog of the switch statement construct, that compares an expression against one or more cases as a control-of-flow measure.
The assignment statement (=) binds a name as a reference to a separate, dynamically allocated object. Variables may subsequently be rebound at any time to any object. In Python, a variable name is a generic reference holder without a fixed data type; however, it always refers to some object with a type.
===Expressions===
*The +, -, and * operators for mathematical addition, subtraction, and multiplication are similar to other languages, but the behavior of division differs. There are two types of divisions in Python: floor division (or integer division) // and floating-point/division. Python uses the ** operator for exponentiation.
*Python uses the + operator for string concatenation. Python uses the * operator for duplicating a string a specified number of times.
*The @ infix operator. It is intended to be used by libraries such as NumPy for matrix multiplication.
*The syntax :=, called the "walrus operator", was introduced in Python 3.8. It assigns values to variables as part of a larger expression.
*In Python, == compares by value. Python's is operator may be used to compare object identities (comparison by reference), and comparisons may be chained—for example, a <= b <= c.
*Python uses and, or, and not as Boolean operators.
*Python has a type of expression named a list comprehension, and a more general expression named a generator expression."PEP 289 – Generator Expressions" - Hettinger, Raymond (30 January 2002)
*Conditional expressions are written as x if c else y"PEP 308 – Conditional Expressions" - Hettinger, Raymond (7 February 2003) (different in order of operands from the c ? x : y operator common to many other languages).
*Python has array index and array slicing expressions in lists, denoted as a[key], a[start:stop] or a[start:stop:step]. Indexes are zero-based, and negative indexes are relative to the end.
*Python makes a distinction between lists (ex. [1,2,3]) and tuples (ex. (1,2,3)).
==List of implementations==
*CPython - This implementation is written in C, and is the extension of Python. 
*CLPython – Implementation, written in Common Lisp
*ActivePython – Distribution with more than 300 included packages
*Intel Distribution for Python – High performance distribution with conda and pip package managers
*PSF Python – Reference distribution that includes only selected standard libraries
*Cython – programming language to simplify writing C and C++ extension modules for the CPython Python runtime.
*IronPython – Python for CLI platforms (including .NET and Mono)
*Jython– Python for Java platforms
*MicroPython – Python 3 implementation for microcontroller platforms
*Nuitka – a source-to-source compiler which compiles Python code to C/C++ executables, or source code.
*Numba – NumPy aware LLVM-based JIT compiler
*Pyjs – a framework (based on Google Web Toolkit (GWT) concept) for developing client-side Python-based web applications, including a stand-alone Python-to-JavaScript compiler, an Ajax framework and widget toolkit
*PyPy – Python (originally) coded in Python, used with RPython, a restricted subset of Python that is amenable to static analysis and thus a JIT.
*Shed Skin – a source-to-source compiler from Python to C++
*Stackless Python – CPython with coroutines
==Programming Examples==
===Hello, world!===
print('Hello, world!')
===Program to calculate the factorial of a positive integer:===
n = int(input('Type a number, and its factorial will be printed: '))
if n < 0:
 raise ValueError('You must enter a non-negative integer')
factorial = 1
for i in range(2, n + 1):
 factorial *= i
print(factorial)
===Using HTML and PHP===
Python is a dynamically-typed programming language. With the extension of PyScript, both HTML and PHP have <py> (or <py>-script) tag for scripting with Python. The tag allows programmers to use Python code directly in their HTML template.Pyscript Tutorial With Simple Code Examples - pythonistaplanet.com
<html>
 <head>
 <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
 <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
 <title>My First Page</title>
 </head>
 <body>
 <py-script> print ('Hello World') </py-script>
 </body>
</html>
==External Links==
*Python in Wikipedia.
==References==
Category:Programming languages