Basic syntax of python language, Basic Computer Science

The Python language has a lot of similarities to Perl, C and Java. Though, there are some specific differences between the languages.
First Python Program:
relative Mode Programming:
Calling up the interpreter exclusive of passing a script file as a parameter brings up the following on time:
$ python
Python 2.5 (r25:51908, Nov 6 2007, 16:54:01)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type "help", "copyright", "credits" or "license" for more info.
>>>
The following text you have to type to the right of the Python prompt and push the Enter key:
>>> print "Hello, Python!";
This will generate following result:
Hello, Python!
Script Mode Programming:
Calling up the interpreter by a script parameter starts execution of the script and continues until the script is ended. When the script is ended, the interpreter is no longer active.
Let us write a easy Python program in a script. All python files will have conservatory .So place the following source code in a test.py file.
#!/usr/bin/python

print "Hello, Python!";
Here we implicit that you have Python interpreter available in /usr/bin directory. Now attempt to run this program as follows:
$ chmod +x test.py # This is to make file executable
$ python test.py
This will generate following outcome:
Hello, Python!
Posted Date: 5/4/2012 9:24:50 AM | Location : United States







Related Discussions:- Basic syntax of python language, Assignment Help, Ask Question on Basic syntax of python language, Get Answer, Expert's Help, Basic syntax of python language Discussions

Write discussion on Basic syntax of python language
Your posts are moderated
Related Questions
2. What benefits can a company gain by managing its own information infrastructure and services?

How do I change file permissions? Every time I execute chmod commands it tells me permission denied.

Regardless of of the fact that a thread must execute in process, the process and its associated threads are different notion. Processes are used to group resources together and thr

(iv) Suppose that the TCP entity receives a 1.5 megabyte file from the application layer and that the IP layer is willing to carry blocks of maximum size 1500 bytes. Calculate the

Analog Transmission: In analog transmission, there is a continuous up and down pattern. For example, one wave constitutes one cycle, which is measured in the unit called Hertz

Question 1 Explain the different categories of Software applications Question 2 Write a note on Data Dictionaries Question 3 Explain the following (a) Top-down testin

Time Sharing Time sharing allows a large number of users at various remote terminals to simultaneously use a centrally located computer for problem solving. Each user operates

WHAT IS MULTIPLE CONTIGUOUS VARIABLE PARTITIONING

what is Metropolitan area network?

Question 1 Define the concept of equivalence relation. Give atleast two examples of equivalence relation Question 2 Prove that a graph G is connected if and only if it has a