Python Functions

Funtion Declaration :   def Hello() :

print ("Hello")

Function Parameters : def Numbers(a,b):

if a > b ;

print a

else :

print b

print (2,3)

Funcation Local variables : def Func(x)

x = 21

print x

x = 29

function(x)

print x

Funtion Global Varuiables :

deffunc():
global x
print(x)
x = 12
print (x)
x = 21
print(x)
func()
print(x)

Function Default arguments :

def ad(a,b=4):
print(a*b)
ad('hello')
ad('chennai',2)

Function Keyword Arguments :

def func(a , b=5,c=10)

print 'a is', a,'and b is', b,'c is', c

func(3,7)

func(25, c=24)

func(c =50 , a= 100)

The Taskmanager command in Linux

Top -> is used to as a taskmanager command in Linux

Kill -> is used to stop the current running process in linux at top command.

Keyboard shortCuts

Quick veiw : Cntrl + ALt -> Right
                   : Cntrl +Shift + Alt -->Left




Swap of Two Numbers without third Variable

a = int(raw_input("enter the number 1  :  "))
b = int(raw_input("enter the number 2  :  "))
print "The Two numbers are a = ", a, " and b = ", b
a, b = b, a
print "The swap of two numbers are a =", a," and b= ", b