Python (programming language)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Original author(s) Guido van Rossum
Stable release 3.4.1 /
May 18, 2014 (2014-05-18)[1]
2.7.8 /
May 31, 2014 (2014-05-31)[2]
Operating system Any
Platform Any
License Python License[3]

Python is an open source programming language that was made to both look good and be easy to read. It was created by a programmer named Guido van Rossum in 1991. The language is named after the television show Monty Python's Flying Circus and many examples and tutorials include jokes from the show.

Python is an interpreted language. An interpreted language allows the programmer to give the source code to the computer and the computer runs the code right away. This means if the programmer needs to change the code they can quickly see the results. This makes Python a good programming language for beginners and for making programs rapidly because you do not have to compile the code to make it run, and compiling takes a lot of time. But because the computer has to figure out what the code does every time the code runs, Python is a very slow language. Sometimes, it can be 200 times slower than C.[source?]

Python is also a high-level programming language. A high-level language has advanced features which let the programmer to tell the computer what to do without having to worry about how the computer is going to do that as much as low-level programming languages. This makes writing programs easier and faster. Some of the rules of how you write code in Python are taken from C, and Python can run some C code.

Syntax[change | change source]

Python has a very easy to read syntax. Some of it comes from C, because that is the language that Python was written in. One big change with Python is the use of whitespace to delimit code: spaces or tabs are used to organize code by the amount of spaces or tabs. This means at the end of each line, a semicolon is not needed and curly braces ({}) are not used to group code, which are both common in C. The combined effect makes Python a very easy to read language.

Usage[change | change source]

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:

  • Web development
  • Game programming
  • Desktop GUIs
  • Scientific programming
  • Network programming.

Example[change | change source]

This is a small example of a Python 2.7 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
print x
x = "Word"
print x

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.

References[change | change source]

  1. "Python 3.4.1". Python Software Foundation. Retrieved September 30, 2014.
  2. "Python 2.7.8 Release". Python Software Foundation. Retrieved September 30, 2014.
  3. "Python legal statements". Python Software Foundation. Retrieved January 28, 2012.

Other websites[change | change source]