Python For Programers Part 2 (Environment And Syntax)

Was this information useful to you?

  • Yes.

    Votes: 1 100.0%
  • No.

    Votes: 0 0.0%
  • Fair Enough.

    Votes: 0 0.0%

  • Total voters
    1
XeroKiryuu

XeroKiryuu

New Member
2
 
Messages
10
Reaction score
27
Points
68
Hello there fellow novice programmers. Keeping in view the warm replies from you in my precious article on Python For Programmers series has been quite encouraging and I am thankful to each and everyone of you from the depths of my heart, So without any further due, Let's jump straight into business!.

1)Python IDE:
Before you start coding and making awesome applications with Python, You need to have Python IDE (Integrated Development Environment) which allows you to execute your codes to see if it has any bugs or errors. Python is a multi-platform Language and has been manually installed in linux and Mac OS x. But If you feel the need to install it (Which you would if you are using windows... Thank goodness I don't use windows for programming) you need to install the Python IDE. For that follow the steps
Step a) Open your Browser and go to this link [Download Python (Omit the [ ] <-----) And make sure that you download for Windows and download the Windows x86-x64.
Step b) (Which is very simple) INSTALL IT MATE...xD and you are ready to start jumping here and there in Python.

If you are using Linux then use the command
sudo apt-get install python (Don't write this ---> You may need to press Y to confirm)

2) PATH or path:
Programs and other executable files can be in many directories, so operating systems
provide a search path that lists the directories that the OS searches for executables.
The path variable is named as PATH in Unix or Path in Windows (Unix is case-
sensitive; Windows is not).
At the command prompt: type path %path%;C:\Python and press Enter.
Note: C:\Python is the path of the Python directory
So now you are ready to roll and need only to just sit in front of your lappie or computer and WRITE SOME CODE!.

3) Basic Syntax:
As said earlier Python has a very clean syntax with little to no punctuations and has power beyond your wildest imagination.But the only thing is that you need to know what Indentation is, Python is white space sensitive because a Python line ends with a white space instead of a semi-colon ( ; ) like in C++ but this can be a really big pain when you have to write a lot of lines so you have to keep your eyes peeled (Its ok to make mistakes, We're called human for a reason) I'll cover Indentation later in the series.

4) First program:
First program, Hmmm, what can be a programmers first program? Well you may not know but every programmer has sat on the chair in front of a screen and wrote "Hello, World!" as his/her first program. So following the traditional programming approach , we'll as well be making our first program a printer which prints something that we write in our code on the screen.

5) Hello,World!:
Brace yourself people because this part is going to knock your socks off (If you're wearing any xD) print is a built-in function of Python and almost every other programming or scripting language and I'll be comparing C++ code with Python code to see the syntax of both.
Python:
#! /usr/bin/python (Don't write this ---> as I use linux I have to use this line)

print "Hello,World!"

C++:
#include <iostream>

using namespace std;

int main();
{
cout<< "Hello, World!";
return 0;
}

As you can see the clear difference between python and C++ in clean syntax and little to no use of punctuation and there is less mumbo jumbo in Python than in C++ (;D)
So this sums up our second article in the series of Python For Programmers. Hope you learnt something and be sure to comment your codes which would give a positive feedback and remember (Practice Practice Practice) Let me know what you can cook up in your mind and print it right on your screen.
 

Back
Top