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

50 Program to demonstrate methods and functions of Dictionary in Python

Program 1: #getting keys and values material={"books":10,"pens":20,"chairs":30} print(material.keys())  #p...
Read More

49 Program for modifying,adding and printing an element of dictionary in Python

Program: #modifying,adding and printing an element of dictionary std={"name":"kumar","height":5.6,"we...
Read More

48 Program for mathematical operations using SET methods in Python

Program: #mathematical operations using set methods A={10,20,30,40,50} B={10,20,60,70,80} print(A) print(B) print(A|B) print(B|A) ...
Read More

47 Program applying functions on SET in Python

Program: #applying functions on set x={40,10,30,20,50} print(x) print(type(x)) print(len(x)) print(sum(x)) print(max(x)) print(min...
Read More

46 Program to create SET object in Python

Program: #creating set object x={10,20,30,40,50}  #homogeneous elements print(x) print(type(x)) y={501,6.1,True,"hello"} ...
Read More

45 Program to demonstrate Type-Casting for Collection Type in Python

Program: #case 1: Converting List to tuple x=[10,20,30,40,50] print(x,type(x)) y=tuple(x) print(y,type(y)) #case 2: Converting T...
Read More

44 Program for tuple with different elements in Python

Program: #tuple with different elements x=((10,20,30),[40,50,60],"hello",4.5,True) #here elements of a tuple can be either mut...
Read More

43 Program to compute sum of tuple elements using for and while in Python

Program: #computing sum of tuple elements using for and while x=(10,20,30,10,50) # using for-loop sum=0 for p in x:     sum=sum+...
Read More

42 Program to demonstrate nested list in Python

Program: x=[[10,20,30],[40,50,60],[70,80,90]] print(x) print(type(x)) print(len(x)) print(x[0],type(x[0])) #1st list print(x[1],ty...
Read More

41 Program to demonstrate List Functions in Python.

Program: #Functions which can be applied on lists #ex:- len(),max(),min(),sorted(),reversed() x=[60,10,40,30,20,50] print(len(x)) p...
Read More

40 Program to demonstrate List with heterogeneous elements in Python

Program: #list with heterogeneous elements x=[501,6.1,True,"python"] print(x[2]) print(x[3][2]) for p in x:     print(p,ty...
Read More

39 Program to display multiplication tables from 1 t 10 in Python

Program: #program to display multiplication tables from 1 t 10 for i in range(1,11):    for j in range(1,11):       k = i*j       p...
Read More

38 Program to demonstrate range function of For Loop in Python

Program 1: #Range()function: It is a pre-defined function, whose range starts from # 0 to given value(excluding) #ex:- range(10)--->...
Read More

37 Program to printing each character for 3 times in Python

Program: # printing each character for  3 times x='python' for p in x: # p indicates each element of x    i.e p,y,t,h,o,n     ...
Read More

36 Program to demonstrate While loop Continue and Break in Python

Program: while True:     name=input("enter user name:")     if name !='atharva':         continue     password=inpu...
Read More

35 Program to demonstrate while-else and break in Python

Program: #while-else and break x=1 while True:     print("hello")     if(x==5):         break     x=x+1 else:     print...
Read More

34 Program to demonstrate While-Else Loop in Python

Program: #program for while-else x=1 while(x<=5):     print("hello")     x=x+1 else:     print("world") pri...
Read More

33 Program to print multiplication table of a number in Python

Program: #program to print multiplication table of a number n=int(input("Enter a no:")) print("MULTIPLICATION TABLE IS...
Read More

32 Program to find sum of first 'n' no's using while loop in Python

Program: #program to find sum of first 'n' no's using while n=int(input("enter value of n")) x=1 sum=0 while (x...
Read More

31 Program illustrating change in time in Python

Program: #program illustrating change in time time=float(input("Enter current time:")) if(time<=12.00):     print(&qu...
Read More

30 Program to compute total and percentage of 6 subjects and also find the Grade/Class awarded in Python.

Program: s1=90;s2=80;s3=70;s4=85;s5=75;s6=60 total=s1+s2+s3+s4+s5+s6 per=(total/600)*100 print("TOTAL=",total) print(&quo...
Read More

29 Program to find the largest of 3 No's in Python

Program: #Nested blocks #program to find the largest of 3 No's x=int(input("Enter value of x:")) y=int(input("Ente...
Read More

28 Program to find whether a no is even or odd in Python

Program: #program to find whether a no is even or odd x=int(input("Enter a no:")) if(x%2==0):     print(x,"is a Eve...
Read More

27 Program to check whether 2 no's are equal or not in Python

Program: #program to check whether 2 no's are equal or not x=int(input("Enter value of x:")) y=int(input("enter va...
Read More

26 Program to Demonstrate TypeCasting in Python

Program: #Type casting #1. string to int x=input("Enter value of x:") print(x,type(x)) y=int(x) print(y,type(y)) #2...
Read More

36 Program to update data in MySQL Database using PHP.

Program: <?php     $host = "localhost";     $user = "root";     $pass = "1234";     $dbname = "...
Read More

35 Program to display data from MySQL Database in PHP.

Program: <?php     $host = "localhost";     $user = "root";     $pass = "1234";     $dbname = &quo...
Read More

34 Program to Insert Data in MySQL Database using PHP

Database: 1) CREATE DATABASE EMPLOYEES; 2) USE EMPLOYEES; 3) CREATE table emp(id int PRIMARY KEY,name Varchar(20),Salary Integer); Pro...
Read More

33 Program to connect PHP with MySQL Database using PDO::__construct().

Program: <?php     $host = "localhost";     $user = "root";     $pass = "1234";         try     { ...
Read More

32 Program to connect PHP with MySQL Database using mysqli_connect().

Program: <?php     $host = "localhost";     $user = "root";     $pass = "1234";         $conn = my...
Read More

31 Program to Destroy Session in PHP

Program: <?php     session_start();     // Destroy Session Variable     session_unset();     // Destroy Session     session_d...
Read More