Python (programming language)

general-purpose programming language

Python is an open source programming language that was made to be easy-to-read and powerful. A Dutch programmer named Guido van Rossum made Python in 1991. He named it after the television show Monty Python's Flying Circus. Many Python examples and tutorials include jokes from the show.[29]

Python (programming language)
Python logo and wordmark.svg
ParadigmMulti-paradigm: object-oriented,[1] procedural (imperative), functional, structured, reflective
Designed byGuido van Rossum
DeveloperPython Software Foundation
First appearedFebruary 1991; 30 years ago (1991-02)[2]
Stable release3.9.5[3] Edit this on Wikidata / 3 May 2021; 8 days ago (3 May 2021)
Preview release3.10.0b1[3] Edit this on Wikidata / 3 May 2021; 8 days ago (3 May 2021)
Typing disciplineDuck, dynamic, strong typing;[4] gradual (since 3.5, but ignored in CPython)[5]
OSLinux, macOS, Windows 8 and later
and more
LicensePython Software Foundation License
Filename, .pyi, .pyc, .pyd, .pyo (prior to 3.5),[6] Template:Notatypo, .pyz (since 3.5)[7]
Major implementations
CPython, PyPy, Stackless Python, MicroPython, CircuitPython, IronPython, Jython
Cython, RPython, Starlark[8]
Influenced by
ABC,[9] Ada,[10] ALGOL 68,[11] APL,[12] C,[13] C++,[14] CLU,[15] Dylan,[16] Haskell,[17] Icon,[18] Java,[19] Lisp,[20] Modula-3,[14] Perl, Standard ML[12]
Apache Groovy, Boo, Cobra, CoffeeScript,[21] D, F#, Genie,[22] Go, JavaScript,[23][24] Julia,[25] Nim, Ring,[26] Ruby,[27] Swift[28]

Python is an interpreted language. Interpreted languages do not need to be compiled to run. A program called an interpreter runs Python code on almost any kind of computer. This means that a programmer can change the code and quickly see the results. This also means Python is slower than a compiled language like C, because it is not running machine code directly.

Python is a good programming language for beginners. It is a high-level language, which means a programmer can focus on what to do instead of how to do it. Writing programs in Python takes less time than in some other languages.

Python drew inspiration from other programming languages like C, C++, Java, Perl, and Lisp.

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 the CPython reference implementation that would make it faster. When speed is important, a Python programmer can move some of the work of the program to other parts written in programming languages like C or PyPy, a just-in-time compiler. It translates a Python script into C and makes direct C-level API calls into the Python interpreter.

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. On occasions, they are playful approaches to tutorials and reference materials, such as referring to spam and eggs instead of the standard foo and bar.

Python useEdit

Python is used by hundreds of thousands of programmers and is used in many places. Sometimes only Python code is used for a program, but most of the time it is used to do simple jobs while another programming language is used to do more complicated tasks.

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 available that make it possible for the Python language to do more things. These libraries make it a powerful language; it can do many different things.

Some things that Python is often used for are:


Python has a very easy-to-read 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 language.

Statements and control flowEdit

Python's statements include:

  • The assignment statement, or the = sign. In Python, the statement x = 2 means that the name x is bound to the integer 2. Names can be rebound 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.


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.


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

print("Hello World!")

# This code does the same thing, only it is longer:

ready = True
if ready:
    print("Hello World!")

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.

x = 1
x = "Word"

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.


  1. "General Python FAQ — Python 3.9.2 documentation". Retrieved 2021-03-28.
  2. Cite error: The named reference guttag was used but no text was provided for refs named (see the help page).
  3. 3.0 3.1 "Python 3.8.10, 3.9.5, and 3.10.0b1 are now available". 3 May 2021. Retrieved 4 May 2021.
  4. "Why is Python a dynamic language and also a strongly typed language - Python Wiki". Retrieved 2021-01-27.
  5. "PEP 483 -- The Theory of Type Hints".
  6. File extension .pyo was removed in Python 3.5. See PEP 0488
  7. Holth, Moore (30 March 2014). "PEP 0441 -- Improving Python ZIP Application Support". Retrieved 12 November 2015.
  8. "Starlark Language". Retrieved 25 May 2019.
  9. Cite error: The named reference faq-created was used but no text was provided for refs named (see the help page).
  10. "Ada 83 Reference Manual (raise statement)".
  11. Cite error: The named reference 98-interview was used but no text was provided for refs named (see the help page).
  12. 12.0 12.1 "itertools — Functions creating iterators for efficient looping — Python 3.7.1 documentation".
  13. Cite error: The named reference AutoNT-1 was used but no text was provided for refs named (see the help page).
  14. 14.0 14.1 Cite error: The named reference classmix was used but no text was provided for refs named (see the help page).
  15. Cite error: The named reference effbot-call-by-object was used but no text was provided for refs named (see the help page).
  16. Cite error: The named reference AutoNT-2 was used but no text was provided for refs named (see the help page).
  17. Cite error: The named reference AutoNT-3 was used but no text was provided for refs named (see the help page).
  18. Cite error: The named reference AutoNT-4 was used but no text was provided for refs named (see the help page).
  19. Cite error: The named reference AutoNT-5 was used but no text was provided for refs named (see the help page).
  20. Cite error: The named reference AutoNT-6 was used but no text was provided for refs named (see the help page).
  21. "CoffeeScript".
  22. "The Genie Programming Language Tutorial". Retrieved 28 February 2020.
  23. "Perl and Python influences in JavaScript". 24 February 2013. Retrieved 15 May 2015.
  24. Rauschmayer, Axel. "Chapter 3: The Nature of JavaScript; Influences". O'Reilly, Speaking JavaScript. Retrieved 15 May 2015.
  25. Cite error: The named reference Julia was used but no text was provided for refs named (see the help page).
  26. Ring Team (4 December 2017). "Ring and other languages". ring-lang.
  27. Cite error: The named reference bini was used but no text was provided for refs named (see the help page).
  28. Lattner, Chris (3 June 2014). "Chris Lattner's Homepage". Chris Lattner. Retrieved 3 June 2014. The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.
  29. "Python Humor". Retrieved 2020-09-19.
  30. Grinberg, M. (2018). Flask web development: developing web applications with python. " O'Reilly Media, Inc.".
  31. Forcier, J., Bissex, P., & Chun, W. J. (2008). Python web development with Django. Addison-Wesley Professional.
  32. Anders, M. (2011). Python 3 Web Development Beginner's Guide. Packt Publishing Ltd.
  33. Dauzon, S., Bendoraitis, A., & Ravindran, A. (2016). Django: Web Development with Python. Packt Publishing Ltd.
  34. Langtangen, H. P. (2012). A primer on scientific programming with Python. Springer Berlin Heidelberg,.
  35. Virtanen, P., Gommers, R., Oliphant, T. E., Haberland, M., Reddy, T., Cournapeau, D., ... & van der Walt, S. J. (2020). SciPy 1.0: fundamental algorithms for scientific computing in Python. Nature methods, 17(3), 261-272.
  36. Oliphant, T. E. (2007). Python for scientific computing. Computing in Science & Engineering, 9(3), 10-20.
  37. VanderPlas, J. (2016). Python data science handbook: Essential tools for working with data. " O'Reilly Media, Inc.".
  38. Grus, J. (2019). Data science from scratch: first principles with python. O'Reilly Media.
  39. Boschetti, A., & Massaron, L. (2015). Python data science essentials. Packt Publishing Ltd.
  40. Raschka, S. (2015). Python machine learning. Packt publishing ltd.
  41. Bressert, E. (2012). SciPy and NumPy: an overview for developers. " O'Reilly Media, Inc.".
  42. Walt, S. V. D., Colbert, S. C., & Varoquaux, G. (2011). The NumPy array: a structure for efficient numerical computation. Computing in science & engineering, 13(2), 22-30.
  43. Oliphant, T. E. (2006). A guide to NumPy (Vol. 1, p. 85). USA: Trelgol Publishing.
  44. Bruce, P., Bruce, A., & Gedeck, P. (2020). Practical Statistics for Data Scientists: 50+ Essential Concepts Using R and Python. O'Reilly Media.
  45. Goerzen, J. (2004). Foundations of Python network programming. Apress.
  46. Sarker, M. F. (2014). Python Network Programming Cookbook. Packt Publishing Ltd.
  47. Gutschmidt, T. (2004). Game Programming with Python, Lua, and Ruby. Premier Press.
  48. McGugan, W. (2007). Beginning game development with Python and Pygame: from novice to professional. Apress.

Other websitesEdit