Python Language is associate object-oriented artificial language created by Guido Rossum in 1989. it's ideally designed for speedy prototyping of complicated applications. it's interfaces to several OS system calls and libraries and is protractible to C or C++. several massive corporations use the Python artificial language embody NASA, Google, YouTube, BitTorrent, etc.
Python Language is wide utilized in AI, linguistic communication Generation, Neural Networks and alternative advanced fields of engineering science. Python Language had deep specialize in code readability & this category can teach
Python Language First Program
Let us execute programs in different types of programming.
Interactive Mode Programming
Invoking the interpreter without passing script file as a parameter bring up the following prompt −
$ python
Python 2.4.3 (#1, Nov eleven 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for a lot of info.
>>>
Type the following text at the Python prompt and press the Enter −
>>> print "Python, Language!"
If you're running new edition of Python, then you'd ought to use print statement with parenthesis as in print ("Python, Language!");. but in Python version 2.4.3, this produces the following result −
Python, Language!
Script Mode Programming
Invoking the interpreter with a script parameter begins execution of the script and continues till the script is finished. once the script is finished, the interpreter isn't any longer active.
Let us write an easy Python Language program in a very script. Python files are saved extension .py. kind the subsequent ASCII text file in a very take a look at.py file −
print "Python, Language!"
We assume that you simply have Python interpreter set in PATH variable. Now, try to run this program as follows −
$ python take a look at.py
This produces the following result −
Python, Language!
Let us attempt in a different way to execute a Python Language script. Here is that the changed take a look at.py file −
#!/usr/bin/python
print "Python, Language!"
We assume that you just have Python interpreter obtainable in /usr/bin directory. Now, try to run this program as follows −
$ chmod +x take a look at.py # this can be to create file workable
$./test.py
This produces the following result −
Python, Language!
0 comments:
Post a Comment