Why Python ?
Python is a high-level programming language whose syntax is said to be clear and expressive. Python has a large standard library. Python is an easy to understand language we can learn this language in a few days and for making any gaming software we should must have good knowledge of GUI development using that language. GUI development using Python is very easy and understandable as compared to other language like C, C++or Java.
Creating a simple Hello world program
We need a python compiler to compile python programs which can be downloaded from www.python.org
Writing a program in text file or console
print 'hello world'
To get exit from command line interface just type the command exit() .
To get help about some methods related to python or the keywords we can type help in command line interface .Follow these steps
Type python in command line to start the interpreter of python.
Type help .
To get help about keywords or modules available in python just type ethe word keyword.
All these keywords will be discussed in the coming tutorials one by one .As we can see there are nearly 31 keywords available in python 2.6.5.
Print statement is used to print the data in python.Printing a statement in python is just so simple as we dont need to add any libraries for using print command as which we have to do in other languages.We have seen how to print "hello world", we can print same "hello world" in different way by writing 2 words in different inverted commas and printing it .To print 2 words at the same time we use comma operator between them.
Variable are printed by just writing the name of variables and no inbverted commas are required .Variables will be covered in next tutorial ,there we will be showing how to print the variables .
Comments are used to document our code . We write comments in python by using symbol # and writing any expression ,line,or character in front of the #.Compiler ignores the words or expression in comment.
There are two types of comments available in python:
Single line comments
# is used to write the single line comments .
print 'hello world' #will print hello world
will print hello world is a comment and will be ignored by the compiler .
Multiple Line comments
To write multiline comments the symbol is """ """ .
print 'hello world' """ this is a multiline comment """
Any query related to this tutorial can be asked .In our next Tutorial we will discuss about variables .