Blog: Extra-ordinary

Syntax of Python Function

def functionname(parameters): “””docstring””” statement(s) return expression Example: #!/usr/bin/python # Function definition is here def ima( lovestr ): “This prints a passed string into this function” print lovestr return; # Now you can call ima function ima(“I’m fall in love!”)

Continue Reading

Star triangle with python for loop

>>> star =  input(“Enter the star to draw: “) Enter the star to draw: * >>> limit = int(input(“Enter the limit: “)) Enter the limit: 10 >>> for i in range(1, limit+1): print (star*i) Output–    * ** *** **** ***** ****** ******* ******** ********* **********

Continue Reading

Multiplication table in python

>>> var = 5 >>> for i in range(1,11): multiply = var * i print (“Multiplication table”, var,”*”, i,”=”,multiply)  Output– Multiplication table 5 * 1 = 5 Multiplication table 5 * 2 = 10 Multiplication table 5 * 3 = 15 Multiplication table 5 * 4 = 20 Multiplication table 5 * 5 = 25 Multiplication table 5 * 6 …

Continue Reading

Enabling clean URLs Drupal

Open your .htaccess file in your project root. Uncomment RewriteBase /drupal and change it to your project name like RewriteBase /projectname . Comment RewriteBase / Goto /admin/config/search/clean-urls There will be an option to Enable clean URLs .

Continue Reading

How to show hostname & IP address with python programming

The Internet Protocol assigns a 4-byte address to every computer connected to the network. Such addresses are usually written as four decimal numbers, separated by periods, which each represent a single byte of the address. Each number can therefore range from 0 to 255. So an IP address looks like this: 202.168.3.180 Because purely numeric addresses can be difficult for …

Continue Reading