Posts

Showing posts from August, 2022

FUNCTIONS

 Syntax for defining a function: def func_name(formal arguments/parameters):     #statements calling a function: func_name(actual argments) LEGB Rule for checking scope of variable: Local, Enclosing, Global, Built-in  For passing arguments in a function in any indefinite order : Func1(arg2=value, arg1=val, arg3=val...) - This method is called keyword arguments A function can return multiple value which be later picked up by a variable as tuple if a function doesn't return anything and it is called inside a print statement then the output will be 'None' Common built-in functions: Round(Number, no. of decimal to be rounded off)  Round(12.5)==12 Round(13.5)==14      if the second argument is in negative then it will start round off the tens, hundreds position and so on.  abs(number) - Returns absolute value as int ot floa