Python, an interpreted, interactive, object-oriented, extensible programming language
with automatic memory tracking well use of python is "Google" every application.. expecting new programming language Go will be something like Python with other good features of other programming language
now let's talk about programming part..
for writing executing and writing program
you can download interpreter from Download
or net beans plugin for python from: Download
you don't have to declare what your object type is but yes before using it you have to give reference to object type if necessary
eg..
list/array you can declare in this way.:
Python uses whitespace indentation, rather than curly braces or keywords, to delimit blocks #eg:
Hello World
you are in if loop
you are now running normal
Assigning variable in one line
#one funny program :
it will print the Fibonacci series..
continue and break are same as other language
#traversing list
Module in Python
it is same as header file in c++ and package in java
but it track module through file name
with automatic memory tracking well use of python is "Google" every application.. expecting new programming language Go will be something like Python with other good features of other programming language
now let's talk about programming part..
for writing executing and writing program
you can download interpreter from Download
or net beans plugin for python from: Download
you don't have to declare what your object type is but yes before using it you have to give reference to object type if necessary
eg..
list/array you can declare in this way.:
a=[] #map you can declare in this way.: a={} #set you can declare in this way a=set() #change in python and other programming language: && = and true = True false = False || = or if() = "if():" else if = "elif():" while() = "while():" foreach () = for(): // = # /* --- */ = """ ------- """ #above can be use as multiline string also
Python uses whitespace indentation, rather than curly braces or keywords, to delimit blocks #eg:
a=2 if( a>0): print "HELLO WORLD" print "You are in If Loop" print "You are now running normal"out/put;
Hello World
you are in if loop
you are now running normal
Assigning variable in one line
a,b=0,1will assign a=0 and b=1
#one funny program :
a,b=0,1 while b<1000: print b a,b=b,a+bGuess the o/p of this program
it will print the Fibonacci series..
#checking presence of key,data ,in list or map if a in b: do something ######################################### #writing a function def function_name(variable1,variable2...) return some variable
continue and break are same as other language
#traversing list
#creating a new list from original list a=['my' 'name' 'is','rajesh','patidar'] a[:] # this is will create a copy of a a[2:4] # will create a new list form index 2 to index 3 a[2:] # will create a new list from index 2 to up to last a[:2] #will create a list from starting up to index 1 a[:-2] # will create a new list leaving last two item of list a[::-1] # reverse the list############################################
Module in Python
it is same as header file in c++ and package in java
but it track module through file name
//hello.py def sayHello(name): print "You are welcome MR: "+name #myprg.py import hello sayHello("Rajesh Patidar")
very nice.. raju!
ReplyDeleteI really liked this post!
keep the good wrk going dude, u r doing excellent