Python

249
2362 reads

January 25, 2013

math_function


This function uses the math module and help us to make use of various inbuilt mathematical functions.

349
4908 reads

January 25, 2013

Modulus operator


Using the modulus operator you can check whether one number is divisible by another and you can also extract the right-most digit or digits from a number.

224
3141 reads

January 25, 2013

split-string


The string split method chops up a string into a list of substrings, around a delimiter string. "Whitespace" is considered as the default delimiter.

164
1908 reads

January 25, 2013

find and replace


This code shows how to find the position of a sub-string in a string using the find method.The find method returns the offset where the substring appears.

79
1336 reads

January 25, 2013

Convert to Upper Case


The method upper takes a string and returns a new string with all uppercase letters.

71
1253 reads

January 25, 2013

String Slices


The operator [n:m] returns the part of the string from the "n-eth" character to the "m-eth" character, including the first but excluding the last.

329
3452 reads

January 25, 2013

Replace characters in a string


To replace two characters in the middle of a string, you can use code like this.

154
2350 reads

January 25, 2013

Replace a substring


You can replace a substring in a string using the replace method.

39
1385 reads

January 24, 2013

GREATEST COMMON DIVISOR


This example use Recursive function in which big problem is broken into small problem.

286
4055 reads

January 24, 2013

Bitwise Operations


This code shows ORing, ANDing and bitwise shifting.