What do we need to get started?
Firstly, Install Python from this official website of Python
You can find many versions for Python. I am using Python 2.7, however you can download any latest version compatible with your operating system. Python can be downloaded on MAC, Windows, Linux or others too. Just download it and run the application!
It would look something like this:
This is Interactive mode. ">>>" is known as the command prompt. You can write statements here and press ENTER. They are executed right away. Try this:
You would see:
Immediately as you press Enter.
Now, click on File menu and then click New File. You will see this:
The untitled window is Script mode. you can write your code and save it. You can open it later and edit the code, too. We mostly use Script mode in Python. To run the code in Script mode click Run menu and then click on Run Module. Or do it my way, press the key F5.
Hello World in Python
Here is the game plan. There is absolutely no need to import any module or package to run basic commands. You begin directly with the statement. We will use here print() function. What it does is print on screen whatever we write in parenthesis. Or even without parenthesis. If you wish to print a string enclose it in double quotes ("Like this"). Otherwise no need of "these".
In Interactive Mode:
>>>print "Hello World"
You see this just as you press enter.
In Script Mode:
print "Hello World"Save the file.
Press F5 and you see:
These will work too:
print ("Hello World")
print ("Hello cruel and judging World")