Friday, August 24, 2012

Basic Control Flow in Python

def conditionalStatementTest():
    print("if else statement test:")
    x = int(input("Enter an integer :"))
    if(x < 10) :
        print("x is less then 10")

    elif(x > 10) :
        print("x is grater then 10")

    elif(x == 10) :
        print("x = 10")

def forLoopTest():
    print("Test for loop with range() function")
    for index in range(5):
        print(index)


if  __name__=='__main__':
    conditionalStatementTest()
    forLoopTest()


Python Learning Resource Link

Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
Note for c/c++ Programmer :
It is a two hour job for a programmer who is already experienced with C/C++, to start with Python.
Important Note :About Version :
Before using any version of Python be sure you read the change between previous release and official release note.
Creator of Python :
Guido van Rossum
Popular Python Framework : DJANGO
Why Python
------------------
----under drafting--
Google's Python Class
From Wikipedia :
Good Blog On Python
Popular Opensource Project Using Python
Software Industry And Python Expart :
------------every skill has it's own gravity------------

Hello World Python Script

def addition():
    return(2+2)

def sub():
    return(2-2)

def multiplication():
    return(9999999999999999999999*9999999999999999999)

def piTest():
    return(22/7)


if  __name__=='__main__':
    print("Addition  :", addition())
    print("substraction :", sub())
    print("Multiplication :", multiplication())
    print("PI :", piTest())

Output :

Addition : 4
substraction : 0
Multiplication : 99999999999999999989990000000000000000001
PI : 3.142857142857143


Convert text to ASCII and ASCII to text - Python code

def asciiTest():
 
k = ord('B')

c = chr(66)

print(k)

print(c)

if __name__ == '__main__':
    asciiTest()