Python

276
2662 reads

February 7, 2013

string formatting


This example shows how to embed variable in a string. Variables can be Embed in a string by using specialize format sequence and then putting the variable at the end with a special syntax.

267
3872 reads

February 7, 2013

Data type conversion


sometimes you may need to perform conversions between built in types. To convert types use the type name as function.

32
1359 reads

February 7, 2013

Python-Tuples


A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists.

155
1986 reads

February 7, 2013

59
1331 reads

February 6, 2013

Python - Type Conversion


int( x )- Convert a number or string x to an integer, or return 0 if no arguments are given.
float( x )- Convert a num-string(should contain decimal number) or a number to floating point.

48
1589 reads

February 6, 2013

Python- " isinstance ( ) " Function


isinstance(object, class)

Return True if the object argument is an instance of the class argument. If object is not an object of the given type, the function always returns False.

61
1316 reads

February 6, 2013

Python- " len( ) " Function


len( s )

Return the length (the number of items) of an object. The argument may be a sequence (string, tuple or list) or a mapping (dictionary).

36
1471 reads

February 6, 2013

Python - " abs( ) " Function


The Python interpreter has a number of functions and types built into it that are always available.

331
4642 reads

February 5, 2013

Enumeration


The following example illustrates the use of the enumerate function using a for loop.

25
1289 reads

February 5, 2013

Python- " lambda " Functions


lambda is an anonymous (unnamed) function. It is used primarily to write very short functions.