Sie sind auf Seite 1von 4

2.

Introduction to Python Programming Language

Python is a general-purpose interpreted, interactive, object-oriented and high-level programming


language. Python was created by Guido van Rossum in the late eighties and early nineties. Like
Perl, Python source code is also now available under the GNU General Public License (GPL).
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python
was designed to be highly readable which uses English keywords frequently where as other
languages use punctuation and it has fewer syntactical constructions than other languages.

Python is Interpreted: This means that it is processed at runtime by the interpreter and
you do not need to compile your program before executing it. This is similar to PERL
and PHP.
Python is Interactive: This means that you can actually sit at a Python prompt and
interact with the interpreter directly to write your programs.
Python is Object-Oriented: This means that Python supports Object-Oriented style or
technique of programming that encapsulates code within objects.
Python is Beginner's Language: Python is a great language for the beginner
programmers and supports the development of a wide range of applications from simple
text processing to WWW browsers to games.

Who uses Python and what for?


Python is used for everything! For example:
massively multiplayer online role-playing games like Eve Online, science fictions answer to
World of Warcraft, web applications written in a framework built on Python called Django,
desktop applications like Blender, the 3-d animation suite which makes considerable use of
Python scripts, the Scientific Python libraries (SciPy), instrument control and embedded
systems.

Page 1 of 4

What sort of Language is Python?

The nave view of computer languages is that they come as either compiled languages or
interpreted languages.
At the strictly compiled end languages like C, C++ or Fortran are "compiled"
(converted) into raw machine code for your computer. You point your CPU at that code and it
runs.
Slightly separate from the strictly compiled languages are languages like Java and C# (or
anything running in the .net framework). You do need to explicitly compile these programming
languages but they are compiled to machine code for a fake CPU which is then emulated on
whichever system you run on.
Then there is Python. Python does not have to be explicitly compiled but behind the scenes there
is a system that compiles Python into an intermediate code which is stashed away to make things
faster in future. But it does this without you having to do anything explicit yourself. So from the
point of view of how you use it you can treat it as a purely interpreted language like the shell or
Perl.

Page 2 of 4

Python first Command

After the typing the command above, press the return key.

Look at these Python Commands:

This is our first Python function. A function takes some input, does something with it and
(optionally) returns a value. The nomenclature derives from the mathematics of functions, but we
dont need to fixate on the mathematical underpinnings of computer science in this course.
Our function in this case is print and the command necessarily starts with the name of the
function. The inputs to the function are called its arguments and follow the function inside
round brackets (parentheses). In this case there is a single argument, the text to print.
Note that Python, as with many but not all programming languages, is case sensitive. The word
print is not the same as Print or PRINT.

Page 3 of 4

Use of quotes: do-print-this


If there are no quotes then Python will try to interpret the letters as something it should know
about. With the quotes Python simply interprets it as literal text.
For example, without quotes the string of characters p-r-i-n-t are a command; with quotes
they are the text to be printed. i.e, print and print
Python Scripts
Lets create a test Python script - create a file called hello.py with the following contents.
Make a folder PythonScripts in Directory D:
In that folder, create a new notepad file hello.py
In this file write the following:
#! python
print ("Hello World!")
print ("Programming is fun!")
A Python script can be executed at command line by invoking the interpreter on your
application.
On the command line interface, change directory (cd) to D:
Navigate to the directory where you have saved your python scripts, i.e, PythonScripts
Use the command: cd PythonScripts then press enter key on the keyboard.

Refer to this link for online tutorials: http://www.tutorialspoint.com/python

Page 4 of 4

Das könnte Ihnen auch gefallen