Python (programming language)

**Python** is an open-source programming language. It was made as a language that is both easy to work on and understand. It was made by a Dutch programmer named Guido van Rossum in 1991, who named it after the television program Monty Python's Flying Circus.

Python is an interpreted language. This means it does not need to be compiled before running. A program called an interpreter runs Python code on almost any computer. So, a programmer can change the code and quickly see what happens. But this also makes Python slower than compiled languages like C, because it is not changed into machine code before running. Instead, this happens while the program is running.

## Python use

Python is usually used for making websites, automating common tasks, and making charts and graphs. Since it's simple to learn, people who are not computer experts, like bookkeepers and researchers, often learn Python.

Its standard library is made up of many functions that come with Python when it is installed. On the Internet, there are many other libraries, which have been examined to provide wonderful ends in varied areas like Machine Learning (ML), Deep Learning, etc. These libraries make it a powerful language; it can do many different things.

Python's developers try to avoid changing the language to make it better until they have a lot of things to change. Also, they try not to make small repairs, called patches, to unimportant parts of CPython, the main version of Python, even if the patches would make it faster. When speed is important, a Python programmer can write some of the program in a different language, like C, or use PyPy, a different kind of Python that uses a just-in-time compiler.

Keeping Python fun to use is an important goal of Python’s developers. It reflects in the language's name, a tribute to the British comedy group Monty Python. Tutorials often take a playful approach, such as referring to spam and eggs instead of the standard foo and bar.

## Syntax

Some of Python's syntax comes from C, because that is the language that Python was written in. But Python uses whitespace to delimit code: spaces or tabs are used to organize code into groups. This is different from C.  In C, there is a semicolon at the end of each line and curly braces ({}) are used to group code. Using whitespace to delimit code makes Python a very easy-to-read, but hard to manage language.

### Statements and control flow

Python's statements include:

- The assignment statement, or the = sign. In Python, the statement `x = 2` means that the name x is set to the integer 2. Names can be changed to many different types in Python, which is why  Python is a dynamically typed language. For example, you could now type the statement `x = 'spam'` and it would work, but it wouldn't in another language like C or C++.
- The if statement, which runs a block of code if certain conditions are met, along with else and elif (a contraction of else if from other programming languages). The elif statement runs a block of code if the previous conditions are not met, but the conditions for the elif statement are met. The else statement runs a block of code if none of the previous conditions are met.
- The for statement, which iterates over an iterable object such as a list and binds each element of that object to a variable to use in that block of code, which creates a for loop.
- The while statement, which runs a block of code as long as certain conditions are met, which creates a while loop.
- The def statement, which defines a function or method.
- The pass statement, which means "do nothing."
- The class statement, which allows the user to create their own type of objects like what integers and strings are.
- The import statement, which imports Python files for use in the user's code.
- The print statement, which outputs various things to the console.

### Expressions

Python's expressions include some that are similar to other programming languages and others that are not.

- Addition, subtraction, multiplication, and division, represented by +, -. *, and /.
- Exponents, represented by **.
- To compare two values, Python uses ==.
- Python uses the words "and", "or", and "not" for its boolean expressions.
- To check if a value is in a list, Python uses "in"

## Example

This is a small example of a Python program. It shows "Hello World!" on the screen.

Python also does something called "dynamic variable assignment". This means that when a number or word is made in a program, the user does not have to say what type it is. This makes it easier to reuse variable names, making fast changes simpler. An example of this is shown below. This code will make both a number and a word, and show them both, using only one variable.

In a "statically typed" language like C, a programmer would have to say whether `x` was a number or a word before C would let the programmer set up `x`, and after that, C would not allow its type to change from a number to a word.

Python has easy to use functions. In a language like C, you need to tell if it would give you back a number or word. In Python, you don't have to specify the type.When called, this function returns "Hello, Reader", which is then printed to the screen.

## Other websites

- Python tutorial
- Learn Python
- Learn Python for Data Science

## Infobox (programming language)

- **logo**: Python-logo-notext.svg
- **logo size**: 121px
- **paradigm**: Multi-paradigm programming language, Multi-paradigm: object-oriented programming, object-oriented, procedural programming, procedural (imperative programming, imperative), functional programming, functional, structured programming, structured, reflective programming, reflective
- **designer**: Guido van Rossum
- **developer**: Python Software Foundation
- **typing**: duck typing, Duck, dynamic typing, dynamic, strong and weak typing, strong typing; gradual typing, gradual (since 3.5, but ignored in CPython)
- **implementations**: CPython, PyPy, Stackless Python, MicroPython, CircuitPython, IronPython, Jython
- **dialects**: Cython, PyPy#RPython, RPython, Bazel (software), Starlark
- **influenced**: Apache Groovy, Boo (programming language), Boo, Cobra (programming language), Cobra, CoffeeScript, D (programming language), D, F Sharp (programming language), F#, Genie (programming language), Genie, Go (programming language), Go, JavaScript, Julia (programming language), Julia, Nim (programming language), Nim, Ring, Ruby (programming language), Ruby, Swift (programming language), Swift, V (programming language), V (Vlang)
- **license**: Python Software Foundation License
- **wikibooks**: Python Programming
- **influenced by**: ABC (programming language), ABC, Ada (programming language), Ada, ALGOL 68, APL (programming language), APL, C (programming language), C, C++, CLU (programming language), CLU, Dylan (programming language), Dylan, Haskell (programming language), Haskell, Icon (programming language), Icon, Java (programming language), Java, Lisp (programming language), Lisp, Modula-3, Perl, Standard ML
- **operating system**: Windows, Linux, Linux/UNIX, macOS and more
- **file ext**: .py, .pyi, .pyc, .pyd, .pyo (prior to 3.5), , .pyz (since 3.5)