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
10
27
43
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.
 
XeroKiryuu

XeroKiryuu

New Member
10
27
43
@M Shah @Kool Kat Khudara prh lain...xD meri post pri pri gal sar jae gi, hahaha
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Saad Sheikh
Replies
14
Views
241
Maria Hussain J
Maria Hussain J
Saad Sheikh
    • Like
  • Saad Sheikh
  • 47
  • 591
3 4 5
Replies
47
Views
591
intelligent086
intelligent086
Saad Sheikh
  • Sticky
    • Love
    • Like
    • Wow
  • Saad Sheikh
  • 10
  • 395
2
Replies
10
Views
395
Maria-Noor
Maria-Noor
Top
AdBlock Detected
Your browser is blocking advertisements. We're strongly asking to disable ad blocker while you're browsing in Pakistan.web.pk. You may not be aware but any visitor supports our site by just viewing and visiting ads.

آپ کے ویب براؤزر میں ایڈ بلاکر انسٹال ہے، مہربانی کرکے اسے پاکستان ویب پر ڈس ایبل رکھیں ۔ شاید آپ کو معلوم نہ ہو مگر سپانسر اشتہارات کو دیکھ کر ہی آپ پاکستان ویب کو سپورٹ کرتے ہیں۔ سپانسر اشتہارات سے ویب سائٹ کے اخراجات ادا کرنے میں تھوڑی سی ہی سہی مگر مدد ملتی ہے، اس لئے ابھی اپنے براؤزر کی آپشنز میں جاکر ایڈ بلاکر بند کر دیں، شکریہ

I've Disabled AdBlock    No Thanks