Chapter 3 : Function

example 3.1 page no :25

In [1]:
'''
example 3.1 page no :25
'''

def newLine ():
    print ''


print "First Line." 
newLine ()
print "Second Line." 
First Line.

Second Line.

example 3.2 page no :25

In [2]:
'''
example 3.2 page no :25
'''
def newLine ():
    print ''

print "First Line." 
newLine ()
newLine ()
newLine ()
print "Second Line." 
First Line.



Second Line.

example 3.3 page no :26

In [3]:
'''
example 3.3 page no :26
'''


def newLine ():
    print ''


def threeLine ():
    newLine (); 
    newLine ();
    newLine ();
    
print "First Line." 
threeLine()
print "Second Line." 
First Line.



Second Line.

example 3.4 page no :28

In [4]:
# -*- coding: UTF-8 -*-
'''
example 3.4 page no :28
'''

def printTwice (phil):
    print phil , phil


printTwice ('a');
a a

example 3.5 page no :28

In [5]:
# -*- coding: UTF-8 -*-
'''
example 3.5 page no :28
'''


def printTwice (phil):
    print phil , phil

argument = 'b'  
printTwice (argument);
b b
In [ ]: