68 Program to demonstrate map function in Python

Program: '''2)map() function takes 2 arguments i) lambda function ii)list ''' # Python to illustrate map() w...
Read More

67 Program for using lambda functions wirg filter() and map() in Python

Program: '''Lambda functions can be used along with built-in functions like i)filter() ii)map() ''' '&#...
Read More

66 Program to demonstrate Lambda function in Python

Program: #Anonymous function/Lambda function:  #A function which doesnt have any name,is called lambda fn or Anonymous function    ...
Read More

65 Program for passing string as a parameter to function in Python

Program: #passing string as a parameter to function #built-in function list()takes string as a parameter and returns list object x=li...
Read More

64 Program to demonstrate Arbitrary arguments in Python

Program: #Arbitrary arguments or variable length arguments: #here during fn call,we can specify more no of parameters than specified i...
Read More

63 Program for recursive factorial of a number in Python

Program: #factorial program using recursive function def fact(n):     if(n==1):         return 1     else:         return(n*fact(n-1...
Read More

62 Program to demonstrate Boolean function in Python

Program: #Boolean function:function which returns either True/false x=20 y=10 def f1():     if(x>y):         return True     e...
Read More

61 Program to demonstrate keyword and non-keyword argument in Python

Program: def emp(eid,ename,sal,dno,city="hyd"):     print(eid,ename,sal,dno,city) emp(101,"miller",20000,11,"...
Read More

60 Program to demonstrate function with default argument in Python

Program: #2.Default arguments: providing default arguments values in function definition, #if values not specified during fn call,then t...
Read More

59 Program to demonstrate non-default argument in Python

Program: #non-default arguments:providing argument values during fn call def display(name,result):  #specifying its values during fn...
Read More

58 Program to demonstrate global variable in Python

Program: #modifying global variables from within the function. x=10 def display():     #IF I want to modify global variable 'x&#...
Read More

57 Program for overwriting call by reference in Python

Program: #call by reference,overwriting the reference def display(list):     list=[1,2,3,4,5]     print(list)     print(id(list)) li...
Read More

56 Program for call by value and reference in Python

Program: #call by value: calling a function by providing some values #call by reference : calling a function by proving some address de...
Read More

55 Program for different categories of function in Python

Program: #1.function with no parameters and with no return type def sum():     x=10     y=20     z=x+y     print("sum=",z)...
Read More

54 Program for function with parameter and return type in Python

Program: #function with return type def sum(x,y):     z=x+y     return z  #wont display anything just retuns value of z sum(10,20) ...
Read More

53 Program for function to print elements of a list in Python

Program: #function to print elements of a list x=[10,20,30,40,50] def display():     for p in x:         print(p) display() Out...
Read More

52 Program for function to add 2 numbers in Python

Program 1: # function to add 2 nos x=int(input("enter value of x: "))    #global variable y=int(input("enter value of y:...
Read More

51 Program to display message using function in Python

Program 1: #function to print a msg def display():              # defining function         """displays a msg"&quo...
Read More