Author Archive


Python Program to Access Environment Variables

Python provides a number of built-in modules and functions for commonly needed programming tasks. For example, to access operating system properties, python provides the module os. You can use the environ object of os module to access operating system environment variables. The object os.environ behaves like a dictionary of environment variable names and its values. […]

How to Find Sum of Digits of a Number in Python

Python’s built-in support for lists, strings and data conversion enables us to write very concise code which usually takes much more code in other languages. For example, the following python 3 code computes sum of digits of a number using a generator expression and an implicit iterator. # python3 code number = int(input("Please enter a […]

How to Compute Factorial in Python

Formula for computing factorial is, Factorial(n) = n*(n-1)*(n-2)…. *1 This can be written as Factorial(n) = n*Factorial(n-1). Hence we can use recursion to find factorial of a number.The following Python 3 program computes factorial of a number using recursion. # python 3.6+ needed def factorial(n): if n==1 or n==0: return 1 else: return n * […]

C Program to Create Multiplication Table

Multiplication table is a table of products of decimal sequence of numbers. For example, a multiplication table of 5 by 5 contains a top most row with values ranging from 1 to 5 and a left most row with values ranging from 1 to 5. The middle cells contains the algebraic product of the corresponding […]

Java Byte Code Modification Using Cglib and Asm

This article looks at how cglib library can be used for java byte code manipulation at runtime. A number of popular java projects such as spring framework, guice and hibernate internally use cglib for byte code manipulation. Byte code modification enables manipulation or creation of new classes after compilation phase of java applications. In java, […]